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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dan at libby dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Dec 21 13:01:31 2024 UTC