com php-src: Fixed memory leak: main/rfc1867.c
| From: | Dmitry Stogov | Date: | Wed, 05 Mar 2014 06:43:20 +0000 |
| Subject: | com php-src: Fixed memory leak: main/rfc1867.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77742@lists.php.net to get a copy of this message | ||
Commit: 8218ab7724c2dec5af9a1bd1124601823be5cdd8
Author: Xinchen Hui <laruence@gmail.com> Wed, 5 Mar 2014 14:43:20 +0800
Parents: d6d28458d52721719769e7c8c3024d27891f5d54
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8218ab7724c2dec5af9a1bd1124601823be5cdd8
Log:
Fixed memory leak
Changed paths:
M main/rfc1867.c
Diff:
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 3fc8bcf..5acebd5 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]);