diff options
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r-- | Zend/zend_llist.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index ec19038dd0..2a659cef88 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -72,18 +72,26 @@ ZEND_API void zend_llist_del_element(zend_llist *l, void *element) ZEND_API void zend_llist_destroy(zend_llist *l) { - zend_llist_element *current=l->head, *next; + zend_llist_element *current, *next; - while (current) { - next = current->next; - if (l->dtor) { + if (l->dtor) { + current = l->head; + + while (current) { l->dtor(current->data); + current = current->next; } + } + + current = l->head; + while (current) { + next = current->next; pefree(current, l->persistent); current = next; } } + ZEND_API void zend_llist_remove_tail(zend_llist *l) { zend_llist_element *old_tail; |