diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/calloc.c b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/calloc.c index 846096c52c..0fd70a627c 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/calloc.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/calloc.c @@ -1,6 +1,13 @@ #include +#include #include void *calloc(size_t num, size_t size) { - return _ksys_alloc(num*size); -} \ No newline at end of file + void *ptr = _ksys_alloc(num*size); + if(!ptr){ + errno = ENOMEM; + return NULL; + } + memset(ptr, 0, num*size); + return ptr; +}