com php-src: Avoid uncollectable cycle in sxe_property_get _adr: ext/simplexml/simplexml.c

From: Date: Sat, 16 Jul 2016 21:43:24 +0000
Subject: com php-src: Avoid uncollectable cycle in sxe_property_get _adr: ext/simplexml/simplexml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93050@lists.php.net to get a copy of this message
Commit: 735bec4f4018a4009a37d96489afe941c1ad711a Author: Nikita Popov <nikic@php.net> Sat, 16 Jul 2016 23:35:08 +0200 Parents: 2c51a2d00b84a4b9996ed73160cdc5e9faebec12 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=735bec4f4018a4009a37d96489afe941c1ad711a Log: Avoid uncollectable cycle in sxe_property_get_adr The code was storing the created object in a property on the created object, creating a trivial cycle. This cycle cannot be collected (even if sxe->tmp is exposed via get_gc), because it is never rooted (and we cannot safely manually root it). Change the code to store the created object on the parent node instead. The only reason this is not showing up as a leak is that sxe->tmp is dtor'ed in the dtor handler, which means that these objects do get collected on shutdown -- but never earlier. Changed paths: M ext/simplexml/simplexml.c Diff: diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 9e7e114..622ff3b 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -713,7 +713,6 @@ static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, vo _node_as_zval(sxe, node, &ret, type, name, sxe->iter.nsprefix, sxe->iter.isprefix); - sxe = Z_SXEOBJ_P(&ret); if (!Z_ISUNDEF(sxe->tmp)) { zval_ptr_dtor(&sxe->tmp); }

« previous php.cvs (#93050) next »