From aa194611514bf456b7c44cb0ccf3dec84021a767 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Tue, 2 Apr 2024 22:58:22 +0200 Subject: [PATCH] Don't use a heap allocation to track the current item --- ext/dom/dom_iterators.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index a9391370377..11bac506004 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -76,19 +76,15 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */ { - xmlNode *nodep = NULL; - nodeIterator *iter; int htsize; if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) { - iter = emalloc(sizeof(nodeIterator)); - iter->cur = 0; - iter->index = index; - iter->node = NULL; - xmlHashScan(ht, itemHashScanner, iter); - nodep = iter->node; - efree(iter); - return nodep; + nodeIterator iter; + iter.cur = 0; + iter.index = index; + iter.node = NULL; + xmlHashScan(ht, itemHashScanner, &iter); + return iter.node; } else { return NULL; }