summaryrefslogtreecommitdiff
path: root/main/rfc1867.c
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2015-01-22 10:12:06 +0100
committerMichael Wallner <mike@php.net>2015-01-22 10:16:38 +0100
commit86aab0aedbf073d44f5fde4c408b0108bf6ae0d9 (patch)
treec07aeafbf7ad0d4ccca84eaf0abde3e3a82d1e92 /main/rfc1867.c
parentb2c39c1d2930d7c68cc090193ea8765201d61f0c (diff)
downloadphp-git-86aab0aedbf073d44f5fde4c408b0108bf6ae0d9.tar.gz
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]
Diffstat (limited to 'main/rfc1867.c')
-rw-r--r--main/rfc1867.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 58617d4f6d..a1ba99f08c 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);