Fix stream leak in phar cache_list

This commit is contained in:
Nikita Popov 2019-06-24 17:35:22 +02:00
parent 74a7d00846
commit c7962207d7
3 changed files with 3 additions and 3 deletions

View File

@ -206,7 +206,7 @@ void plist_entry_destructor(zval *zv)
free(res);
}
int zend_init_rsrc_list(void)
ZEND_API int zend_init_rsrc_list(void)
{
zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0);
return SUCCESS;

View File

@ -45,7 +45,7 @@ void list_entry_destructor(zval *ptr);
void plist_entry_destructor(zval *ptr);
void zend_clean_module_rsrc_dtors(int module_number);
int zend_init_rsrc_list(void);
ZEND_API int zend_init_rsrc_list(void); /* Exported for phar hack */
int zend_init_rsrc_plist(void);
void zend_close_rsrc_list(HashTable *ht);
void zend_destroy_rsrc_list(HashTable *ht);

View File

@ -113,7 +113,7 @@ static void phar_split_cache_list(void) /* {{{ */
/* fake request startup */
PHAR_G(request_init) = 1;
zend_hash_init(&EG(regular_list), 0, NULL, NULL, 0);
zend_init_rsrc_list();
EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
PHAR_G(has_bz2) = zend_hash_str_exists(&module_registry, "bz2", sizeof("bz2")-1);