libc.obj: Fixed calloc function

git-svn-id: svn://kolibrios.org@9189 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-09-13 19:02:24 +00:00
parent 329531cd24
commit 4918685b4a

View File

@ -1,6 +1,13 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/ksys.h>
void *calloc(size_t num, size_t size) {
return _ksys_alloc(num*size);
void *ptr = _ksys_alloc(num*size);
if(!ptr){
errno = ENOMEM;
return NULL;
}
memset(ptr, 0, num*size);
return ptr;
}