summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2008-08-08 15:41:25 +0000
committerPierre Joye <pajoye@php.net>2008-08-08 15:41:25 +0000
commitb9d7e8b0484b6f643a59fe09ca77821925ccecce (patch)
tree93070845bd7095a4809072c5145809132b367d75 /ext/zip/php_zip.c
parent5505650cdf6c726c3b4f320affe52ee644d20d65 (diff)
downloadphp-git-b9d7e8b0484b6f643a59fe09ca77821925ccecce.tar.gz
- MFH: fix leak in zif_zip_entry_read and ::ExtractTo on Error
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 461a9c045c..1c6f46c067 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1155,7 +1155,7 @@ static PHP_NAMED_FUNCTION(zif_zip_read)
if (ret != 0) {
efree(zr_rsrc);
- RETURN_LONG((long)ret);
+ RETURN_FALSE;
}
zr_rsrc->zf = zip_fopen_index(rsrc_int->za, rsrc_int->index_current, 0);
@@ -1163,6 +1163,7 @@ static PHP_NAMED_FUNCTION(zif_zip_read)
rsrc_int->index_current++;
ZEND_REGISTER_RESOURCE(return_value, zr_rsrc, le_zip_entry);
} else {
+ efree(zr_rsrc);
RETURN_FALSE;
}
@@ -1244,6 +1245,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
buffer[n] = 0;
RETURN_STRINGL(buffer, n, 0);
} else {
+ efree(buffer);
RETURN_EMPTY_STRING()
}
} else {