summaryrefslogtreecommitdiff
path: root/ext/wddx
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-12-06 14:46:15 +0100
committerAnatol Belski <ab@php.net>2016-12-06 14:46:15 +0100
commit8c403ecd99c835895b23c948574be044be3bf653 (patch)
tree98522c7f6291d52221dbf745d6c1e7489195c022 /ext/wddx
parentb9a138dbc8e7cc62f585d3bb054064cc433a8908 (diff)
parent4e3f728701220d36b50dd3005acb671d17ff8400 (diff)
downloadphp-git-8c403ecd99c835895b23c948574be044be3bf653.tar.gz
Merge branch 'PHP-7.1'
* PHP-7.1: fix leak, take on 7.x
Diffstat (limited to 'ext/wddx')
-rw-r--r--ext/wddx/tests/bug73631.phpt2
-rw-r--r--ext/wddx/wddx.c9
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 3cefd48ce9..040a04209f 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);