diff options
author | Anatol Belski <ab@php.net> | 2016-09-14 12:07:38 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-09-14 12:07:38 +0200 |
commit | 001fbbb94f6a182e9db1ddcbad73ce7f4076f117 (patch) | |
tree | 6ef4162ddd863898307a5325a4f466a2d1d8c4a1 /ext | |
parent | acc574d76b60d23b48f8fa561084eb859c2e0766 (diff) | |
download | php-git-001fbbb94f6a182e9db1ddcbad73ce7f4076f117.tar.gz |
fix erroneous resource destruction
Diffstat (limited to 'ext')
-rw-r--r-- | ext/phar/tar.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c index b3dfad8be7..3a601913ac 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -1002,6 +1002,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int efree(entry.filename); return EOF; } + /* At this point the entry is saved into the manifest. The manifest destroy + routine will care about any resources to be freed. */ } else { zend_hash_str_del(&phar->manifest, ".phar/alias.txt", sizeof(".phar/alias.txt")-1); } @@ -1015,12 +1017,6 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (error) { spprintf(error, 0, "unable to access resource to copy stub to new tar-based phar \"%s\"", phar->fname); } - if (entry.fp) { - php_stream_close(entry.fp); - } - if (entry.filename) { - efree(entry.filename); - } return EOF; } if (len == -1) { @@ -1048,12 +1044,6 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (error) { spprintf(error, 0, "unable to read resource to copy stub to new tar-based phar \"%s\"", phar->fname); } - if (entry.fp) { - php_stream_close(entry.fp); - } - if (entry.filename) { - efree(entry.filename); - } return EOF; } free_user_stub = 1; @@ -1070,12 +1060,6 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int if (free_user_stub) { efree(user_stub); } - if (entry.fp) { - php_stream_close(entry.fp); - } - if (entry.filename) { - efree(entry.filename); - } return EOF; } pos = user_stub + (pos - tmp); |