php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10029 zend_list_do_delete() ignores HashTable* param. Potential mem leak.
Submitted: 2001-03-27 13:54 UTC Modified: 2001-04-30 05:15 UTC
From: dan at libby dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 47 = ?
Subscribe to this entry?

 
 [2001-03-27 13:54 UTC] dan at libby dot com
from Zend/zend_list.c

Note that list is passed in, but &EG(regular_list) is used wherever list should be used.

static inline int zend_list_do_delete(HashTable *list,int id)
{
	zend_rsrc_list_entry *le;
	ELS_FETCH();
	
	if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
/*		printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
		if (--le->refcount<=0) {
			return zend_hash_index_del(&EG(regular_list), id);
		} else {
			return SUCCESS;
		}
	} else {
		return FAILURE;
	}
}

.
.
.

Scroll down, and we see that both zend_list_delete and zend_plist_delete are calling this with different hashtable args.  It looks as though we must be leaking memory whenever zend_plist_delete is called.

ZEND_API int zend_list_delete(int id)
{
	ELS_FETCH();

	return zend_list_do_delete(&EG(regular_list), id);
}


ZEND_API int zend_plist_delete(int id)
{
	ELS_FETCH();

	return zend_list_do_delete(&EG(persistent_list), id);
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-30 05:15 UTC] zeev@php.net
zend_plist_delete() was redundant and removed from the CVS a few weeks ago (it didn't make it for 4.0.5, but will be in 4.0.6)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC