slab: add kzalloc
This commit is contained in:
parent
39c778d2f0
commit
47edaa8512
2 changed files with 11 additions and 0 deletions
10
mem/slab.c
10
mem/slab.c
|
|
@ -152,6 +152,16 @@ void *kmalloc(size_t size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void *kzalloc(size_t size)
|
||||
{
|
||||
void *ret = kmalloc(size);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void kfree(void *ptr)
|
||||
{
|
||||
if (ptr == NULL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue