summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2014-03-05 14:43:20 +0800
committerXinchen Hui <laruence@gmail.com>2014-03-05 14:43:20 +0800
commit8218ab7724c2dec5af9a1bd1124601823be5cdd8 (patch)
tree6edd693fa8be584d3c57e0d16d1363e0cba50d16
parentd6d28458d52721719769e7c8c3024d27891f5d54 (diff)
downloadphp-git-8218ab7724c2dec5af9a1bd1124601823be5cdd8.tar.gz
Fixed memory leak
-rw-r--r--main/rfc1867.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 3fc8bcf379..5acebd5b5b 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -196,6 +196,12 @@ static int unlink_filename(zval *el TSRMLS_DC) /* {{{ */
}
/* }}} */
+
+static void free_filename(zval *el) {
+ char *filename = (char*)Z_PTR_P(el);
+ efree(filename);
+}
+
void destroy_uploaded_files_hash(TSRMLS_D) /* {{{ */
{
zend_hash_apply(SG(rfc1867_uploaded_files), unlink_filename TSRMLS_CC);
@@ -759,7 +765,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0);
ALLOC_HASHTABLE(uploaded_files);
- zend_hash_init(uploaded_files, 5, NULL, free_string_zval, 0);
+ zend_hash_init(uploaded_files, 5, NULL, free_filename, 0);
SG(rfc1867_uploaded_files) = uploaded_files;
array_init(&PG(http_globals)[TRACK_VARS_FILES]);