From 735bec4f4018a4009a37d96489afe941c1ad711a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 16 Jul 2016 23:35:08 +0200 Subject: [PATCH] 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. --- ext/simplexml/simplexml.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 9e7e114554..622ff3b6ec 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); } -- 2.50.1