From 86aab0aedbf073d44f5fde4c408b0108bf6ae0d9 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 22 Jan 2015 10:12:06 +0100 Subject: 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] --- main/rfc1867.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main/rfc1867.c') 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); -- cgit v1.2.1