From: Dmitry Stogov Date: Tue, 19 Feb 2013 14:21:31 +0000 (+0400) Subject: Added check for calloc() failure X-Git-Tag: php-5.5.0beta1~42^2~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fcdd25e83e2193854cd80c314af8e8bcd38fcda;p=php Added check for calloc() failure --- diff --git a/shared_alloc_win32.c b/shared_alloc_win32.c index fad75be77d..61dbd80c6a 100644 --- a/shared_alloc_win32.c +++ b/shared_alloc_win32.c @@ -211,6 +211,11 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ /* creating segment here */ *shared_segments_count = 1; *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment)+sizeof(void *)); + if (!*shared_segments_p) { + zend_win_error_message(ACCEL_LOG_FATAL, "calloc() failed"); + *error_in = "calloc"; + return ALLOC_FAILURE; + } shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *)); (*shared_segments_p)[0] = shared_segment;