summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/phar/tar.c20
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);