From 540a3dbf33315e0be8a0389cfe69362d45fcacf4 Mon Sep 17 00:00:00 2001 From: Unbit Date: Fri, 11 Jul 2014 08:42:18 +0200 Subject: [PATCH] first round from ticket #661 --- core/utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/utils.c b/core/utils.c index 32728990..cfa4231c 100644 --- a/core/utils.c +++ b/core/utils.c @@ -1768,8 +1768,13 @@ void *uwsgi_malloc(size_t size) { void *uwsgi_calloc(size_t size) { - char *ptr = uwsgi_malloc(size); - memset(ptr, 0, size); + char *ptr = calloc(1, size); + if (ptr == NULL) { + uwsgi_error("calloc()"); + uwsgi_log("!!! tried memory allocation of %llu bytes !!!\n", (unsigned long long) size); + uwsgi_backtrace(uwsgi.backtrace_depth); + exit(1); + } return ptr; }