summaryrefslogtreecommitdiff
path: root/ext/phar
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-01-02 20:43:41 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-01-02 20:43:41 +0000
commit6ca15bfe0f45168efc9aa2dae951b1a584dca588 (patch)
tree39c8a7d88b38a6e191abbe2bba62d16127f210de /ext/phar
parent2aba36846259e162cfd4baf721358471bf5062ca (diff)
downloadphp-git-6ca15bfe0f45168efc9aa2dae951b1a584dca588.tar.gz
Fixed a possible crash when phar_create_signature() fails
Diffstat (limited to 'ext/phar')
-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 e20d609996..45c02714e3 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);
}