Possible leak in zend_llist ?
| From: | l0t3k | Date: | Tue, 27 Aug 2002 11:30:39 +0000 |
| Subject: | Possible leak in zend_llist ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-87517@lists.php.net to get a copy of this message | ||
hi,
im reviewing the source code of zend_llist.c and it appears there may be an
inconsistency in the way deletions are handled which may cause leaks.
in particular the macro DEL_LLIST_ELEMENT only releases memory for a node
if a destructor is specified for the zend_llist, whereas memory is always
allocated for the node when an insert is performed.
this macro is used only in zend_llist_apply_with_del and
zend_llist_del_element. note that
no other code in the file assumes that the destructor function is
responsible for the deallocation of the _node_
compare DEL_LLIST_ELEMENT (snippet)
if ((l)->dtor) {\
(l)->dtor((current)->data);\
pefree((current), (l)->persistent);\
}\
with zend_llist_destroy
if (l->dtor) {
l->dtor(current->data);
}
pefree(current, l->persistent);
l0t3k