Re: Possible leak in zend_llist ?

From: Date: Sun, 01 Sep 2002 19:19:48 +0000
Subject: Re: Possible leak in zend_llist ?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-87705@lists.php.net to get a copy of this message
Hey, I think you're right. Someone changed this code a while ago and might have introduced this problem (or it was like this before). I commited a fix and hope it doesn't break anything :) If anyone uses llist's please make sure it's OK. Andi At 07:30 AM 8/27/2002 -0400, l0t3k wrote:
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 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.dev (#87705) next »