diff options
| author | Greg Beaver <cellog@php.net> | 2008-03-21 19:54:07 +0000 |
|---|---|---|
| committer | Greg Beaver <cellog@php.net> | 2008-03-21 19:54:07 +0000 |
| commit | 891067c9750622bab7ca3af967e864c5867d7103 (patch) | |
| tree | 37d599a45d2905f8c3b4aed8772272fe844a1732 /ext/phar/util.c | |
| parent | 384d50b37bf0e9d82e5b8845dd6007b756d78fd8 (diff) | |
| download | php-git-891067c9750622bab7ca3af967e864c5867d7103.tar.gz | |
fix the memleak - but this breaks the \*compressAllFiles\*() methods because of fatal flaw
in renaming implementation - see pecl-dev email for details
Diffstat (limited to 'ext/phar/util.c')
| -rw-r--r-- | ext/phar/util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/phar/util.c b/ext/phar/util.c index 6f38a17c8a..092134c2bc 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -77,6 +77,7 @@ void phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress char *oldname = NULL, *oldpath = NULL; char *basename = NULL, *basepath = NULL; char *newname = NULL, *newpath = NULL; + dtor_func_t save; if (phar->flags && compress) { char *error; @@ -158,6 +159,12 @@ void phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress zend_hash_update(&(PHAR_GLOBALS->phar_alias_map), newpath, strlen(newpath), (void*)&phar, sizeof(phar_archive_data*), NULL); } + /* remove old guy, add new guy */ + save = PHAR_GLOBALS->phar_fname_map.pDestructor; + /* don't destruct, we are only renaming */ + PHAR_GLOBALS->phar_fname_map.pDestructor = NULL; + zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), oldpath, phar->fname_len); + PHAR_GLOBALS->phar_fname_map.pDestructor = save; zend_hash_add(&(PHAR_GLOBALS->phar_fname_map), newpath, strlen(newpath), (void*)&phar, sizeof(phar_archive_data*), NULL); efree(phar->fname); |
