com php-src: - Fix possible memory leak: ext/zip/php_zip.c

From: Date: Sun, 20 Oct 2013 03:04:55 +0000
Subject: com php-src: - Fix possible memory leak: ext/zip/php_zip.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73729@lists.php.net to get a copy of this message
Commit: 420068c6e1806a2b12be481abba1afec5d73d82e Author: Felipe Pena <felipensp@gmail.com> Sun, 20 Oct 2013 01:04:55 -0200 Parents: 85a622e42f815c3a62008eff21ec4ab259906e7e Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=420068c6e1806a2b12be481abba1afec5d73d82e Log: - Fix possible memory leak Changed paths: M ext/zip/php_zip.c Diff: diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index d7bd5f4..df16383 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; } /* }}} */

« previous php.cvs (#73729) next »