Added check for calloc() failure

This commit is contained in:
Dmitry Stogov 2013-02-19 18:21:31 +04:00
parent 6ee2602317
commit 1fcdd25e83

View File

@ -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;