summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-10-20 01:04:55 -0200
committerFelipe Pena <felipensp@gmail.com>2013-10-20 01:04:55 -0200
commit420068c6e1806a2b12be481abba1afec5d73d82e (patch)
tree23da3dde2c4707bbc24e45c23ec498129bee02a1
parent85a622e42f815c3a62008eff21ec4ab259906e7e (diff)
downloadphp-git-420068c6e1806a2b12be481abba1afec5d73d82e.tar.gz
- Fix possible memory leak
-rw-r--r--ext/zip/php_zip.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index d7bd5f49e6..df16383d10 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1856,15 +1856,16 @@ static ZIPARCHIVE_METHOD(addFromString)
/* TODO: fix _zip_replace */
if (cur_idx >= 0) {
if (zip_delete(intern, cur_idx) == -1) {
- RETURN_FALSE;
+ goto fail;
}
}
- if (zip_add(intern, name, zs) == -1) {
- RETURN_FALSE;
- } else {
+ if (zip_add(intern, name, zs) != -1) {
RETURN_TRUE;
}
+fail:
+ zip_source_free(zs);
+ RETURN_FALSE;
}
/* }}} */