diff options
author | Anatol Belski <ab@php.net> | 2016-12-06 14:42:59 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-12-06 16:24:12 +0100 |
commit | 7f22627870995dd16ff279a5cb8576efb8207b3c (patch) | |
tree | f6240145636d7b0bc7c3ee9df09c17985238596e | |
parent | 7eb7831295043afb132061a94526960941d40898 (diff) | |
download | php-git-7f22627870995dd16ff279a5cb8576efb8207b3c.tar.gz |
fix leak, take on 7.x
(cherry picked from commit 9b1430140a75698fd30b304d9bb488a2ce189750)
-rw-r--r-- | ext/wddx/tests/bug73631.phpt | 2 | ||||
-rw-r--r-- | ext/wddx/wddx.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ext/wddx/tests/bug73631.phpt b/ext/wddx/tests/bug73631.phpt index 880ada5a5d..1fcde72dfe 100644 --- a/ext/wddx/tests/bug73631.phpt +++ b/ext/wddx/tests/bug73631.phpt @@ -2,8 +2,6 @@ Bug #73631 (Memory leak due to invalid wddx stack processing) --SKIPIF-- <?php if (!extension_loaded("wddx")) print "skip"; ?> ---XFAIL-- -Still has memory leaks, not sure how to fix them. --FILE-- <?php $xml = <<<EOF diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 662b957369..d58a564593 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -907,8 +907,13 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) } if (!strcmp((char *)name, EL_BINARY)) { - zend_string *new_str = php_base64_decode( - (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + zend_string *new_str = NULL; + + if (ZSTR_EMPTY_ALLOC() != Z_STR(ent1->data)) { + new_str = php_base64_decode( + (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + } + zval_ptr_dtor(&ent1->data); if (new_str) { ZVAL_STR(&ent1->data, new_str); |