From 4918685b4a9d8f6edf1ca3806804eb2efdbb277b Mon Sep 17 00:00:00 2001 From: turbocat Date: Mon, 13 Sep 2021 19:02:24 +0000 Subject: [PATCH] libc.obj: Fixed calloc function git-svn-id: svn://kolibrios.org@9189 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../ktcc/trunk/libc.obj/source/stdlib/calloc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; +}