summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-06-05 22:49:31 +0200
committerAnatoliy Belsky <ab@php.net>2012-06-07 21:01:32 +0200
commita37e84e549669dbcca0b94a69a5409591eb0c6bb (patch)
tree2d0b60d3fcdee3a22374a4245f0e292f7e3fbd7d
parentf4a44f18b8fe5d23a11d12b048d4effce283379f (diff)
downloadphp-git-a37e84e549669dbcca0b94a69a5409591eb0c6bb.tar.gz
fixed zip entry freeing
-rw-r--r--ext/zip/php_zip.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 01233159ce..f3d37c8d8f 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1148,7 +1148,13 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if (zr_rsrc) {
if (zr_rsrc->zf) {
- zip_fclose(zr_rsrc->zf);
+ if (zr_rsrc->zf->za) {
+ zip_fclose(zr_rsrc->zf);
+ } else {
+ if (zr_rsrc->zf->src)
+ zip_source_free(zr_rsrc->zf->src);
+ free(zr_rsrc->zf);
+ }
zr_rsrc->zf = NULL;
}
efree(zr_rsrc);
@@ -1321,9 +1327,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open)
}
/* }}} */
-/* {{{ proto void zip_entry_close(resource zip_ent)
+/* {{{ proto bool zip_entry_close(resource zip_ent)
Close a zip entry */
-/* another dummy function to fit in the old api*/
static PHP_NAMED_FUNCTION(zif_zip_entry_close)
{
zval * zip_entry;
@@ -1334,8 +1339,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close)
}
ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry);
- /* we got a zip_entry resource, be happy */
- RETURN_TRUE;
+
+ RETURN_BOOL(SUCCESS == zend_list_delete(Z_LVAL_P(zip_entry)));
}
/* }}} */