summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-01-07 03:12:14 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-01-07 03:12:14 +0000
commitcbf6f5b53839dd72170b8e766fdc7fa0fca5dabe (patch)
tree02b3abae380b9223d1a014f290e31ecd347e9566 /ext/zip/php_zip.c
parenta431a09f47fde8828245a49342c1122ccbfaeeb5 (diff)
downloadphp-git-cbf6f5b53839dd72170b8e766fdc7fa0fca5dabe.tar.gz
Fixed memory leaks on error
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 21291c0133..4f63d74d53 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -689,6 +689,7 @@ static PHP_FUNCTION(zip_read)
rsrc_int->index_current++;
ZEND_REGISTER_RESOURCE(return_value, zr_rsrc, le_zip_entry);
} else {
+ efree(zr_rsrc);
RETURN_FALSE;
}
@@ -770,6 +771,7 @@ static PHP_FUNCTION(zip_entry_read)
buffer[n] = 0;
RETURN_STRINGL(buffer, n, 0);
} else {
+ efree(buffer);
RETURN_EMPTY_STRING()
}
} else {
@@ -1815,6 +1817,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
buffer = safe_emalloc(len, 1, 2);
n = zip_fread(zf, buffer, len);
if (n < 1) {
+ efree(buffer);
RETURN_EMPTY_STRING();
}