com php-src: avoid duplicate array_init: main/rfc18 67.c
| From: | Michael Wallner | Date: | Thu, 22 Jan 2015 09:16:38 +0000 |
| Subject: | com php-src: avoid duplicate array_init: main/rfc18 67.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84307@lists.php.net to get a copy of this message | ||
Commit: 86aab0aedbf073d44f5fde4c408b0108bf6ae0d9
Author: Michael Wallner <mike@php.net> Thu, 22 Jan 2015 10:12:06 +0100
Parents: b2c39c1d2930d7c68cc090193ea8765201d61f0c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=86aab0aedbf073d44f5fde4c408b0108bf6ae0d9
Log:
avoid duplicate array_init
custom request body handling firing the rfc1867 handler after the
environment has been hashed might create a memory leak by calling
array_init() twice on PG(http_globals)[TRACK_VARS_FILES]
Changed paths:
M main/rfc1867.c
Diff:
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 58617d4..a1ba99f 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -769,7 +769,10 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
zend_hash_init(uploaded_files, 8, NULL, free_filename, 0);
SG(rfc1867_uploaded_files) = uploaded_files;
- array_init(&PG(http_globals)[TRACK_VARS_FILES]);
+ if (Z_TYPE(PG(http_globals)[TRACK_VARS_FILES]) != IS_ARRAY) {
+ /* php_auto_globals_create_files() might have already done that */
+ array_init(&PG(http_globals)[TRACK_VARS_FILES]);
+ }
zend_llist_init(&header, sizeof(mime_header_entry), (llist_dtor_func_t) php_free_hdr_entry,
0);