From: Ilia Alshanetsky Date: Fri, 2 Jan 2009 20:43:58 +0000 (+0000) Subject: MFB: Fixed a possible crash when phar_create_signature() fails X-Git-Tag: php-5.4.0alpha1~191^2~4668 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e62d29d851fdc967453acc2ec02ffca31740e642;p=php MFB: Fixed a possible crash when phar_create_signature() fails --- 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); }