Skip to content

Commit aa19461

Browse files
committed
Don't use a heap allocation to track the current item
1 parent 6de0486 commit aa19461

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

ext/dom/dom_iterators.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,15 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const
7676

7777
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
7878
{
79-
xmlNode *nodep = NULL;
80-
nodeIterator *iter;
8179
int htsize;
8280

8381
if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) {
84-
iter = emalloc(sizeof(nodeIterator));
85-
iter->cur = 0;
86-
iter->index = index;
87-
iter->node = NULL;
88-
xmlHashScan(ht, itemHashScanner, iter);
89-
nodep = iter->node;
90-
efree(iter);
91-
return nodep;
82+
nodeIterator iter;
83+
iter.cur = 0;
84+
iter.index = index;
85+
iter.node = NULL;
86+
xmlHashScan(ht, itemHashScanner, &iter);
87+
return iter.node;
9288
} else {
9389
return NULL;
9490
}

0 commit comments

Comments
 (0)