summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2008-01-31 21:58:57 +0000
committerRob Richards <rrichards@php.net>2008-01-31 21:58:57 +0000
commitd1459b85543eaaf6922a71183c25d98163e3cdda (patch)
tree97aab14dadfe24aa77aee21926aa6edfff70096f /ext/simplexml/simplexml.c
parent7b307cc256296764dca1aa09f7c83a054fb45c1f (diff)
downloadphp-git-d1459b85543eaaf6922a71183c25d98163e3cdda.tar.gz
MFH: fix bug #42369 (Implicit conversion to string leaks memory)
add test
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index fce96bbe72..f70efed368 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1787,6 +1787,11 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
}
}
+ if (readobj == writeobj) {
+ INIT_PZVAL(writeobj);
+ zval_dtor(readobj);
+ }
+
rv = cast_object(writeobj, type, (char *)contents TSRMLS_CC);
if (contents) {