Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ext/phar/tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
}

zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass);
/* TODO: memory leak and incorrect continuation if phar_tar_writeheaders fails? */

/* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */
if (!phar->is_data || phar->sig_flags) {
Expand All @@ -1191,6 +1192,12 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
entry.fp = php_stream_fopen_tmpfile();
if (entry.fp == NULL) {
spprintf(error, 0, "phar error: unable to create temporary file");

efree(signature);
if (must_close_old_file) {
php_stream_close(oldfile);
}
php_stream_close(newfile);
return;
}
#ifdef WORDS_BIGENDIAN
Expand Down