com php-src: Added check for calloc() failure: shared_alloc _win32.c
| From: | Dmitry Stogov | Date: | Tue, 19 Feb 2013 14:21:31 +0000 |
| Subject: | com php-src: Added check for calloc() failure: shared_alloc _win32.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71523@lists.php.net to get a copy of this message | ||
Commit: 1fcdd25e83e2193854cd80c314af8e8bcd38fcda
Author: Dmitry Stogov <dmitry@zend.com> Tue, 19 Feb 2013 18:21:31 +0400
Parents: 6ee260231741085f204ea79248c21d3e66dc4c93
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1fcdd25e83e2193854cd80c314af8e8bcd38fcda
Log:
Added check for calloc() failure
Changed paths:
M shared_alloc_win32.c
Diff:
diff --git a/shared_alloc_win32.c b/shared_alloc_win32.c
index fad75be..61dbd80 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;