summaryrefslogtreecommitdiff
path: root/ext/phar/phar.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-01-02 20:43:58 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-01-02 20:43:58 +0000
commite62d29d851fdc967453acc2ec02ffca31740e642 (patch)
tree1b231e3236021914d3fdbd399f83776e9ebed6f1 /ext/phar/phar.c
parent1f44875c1be5c121cd25a612873b4fd10a6e32d5 (diff)
downloadphp-git-e62d29d851fdc967453acc2ec02ffca31740e642.tar.gz
MFB: Fixed a possible crash when phar_create_signature() fails
Diffstat (limited to 'ext/phar/phar.c')
-rw-r--r--ext/phar/phar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 20c17fe1c6..177ab8f32f 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -3122,7 +3122,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
return EOF;
#endif
default: {
- char *digest;
+ char *digest = NULL;
int digest_len;
if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error TSRMLS_CC)) {
@@ -3131,7 +3131,9 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert,
spprintf(error, 0, "phar error: unable to write signature: %s", save);
efree(save);
}
- efree(digest);
+ if (digest) {
+ efree(digest);
+ }
if (closeoldfile) {
php_stream_close(oldfile);
}