com php-src: fix bug #75540 Segfault with libzip 1.3.1: ext/zip/php_zip.c
| From: | Remi Collet | Date: | Mon, 20 Nov 2017 07:49:46 +0000 |
| Subject: | com php-src: fix bug #75540 Segfault with libzip 1.3.1: ext/zip/php_zip.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100311@lists.php.net to get a copy of this message | ||
Commit: de47d4792fdefbcea023877c931cbdc15dd38963
Author: Remi Collet <remi@php.net> Mon, 20 Nov 2017 08:49:46 +0100
Parents: 0e097f2c96ce31b16fa371981045f224e5a37160
Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=de47d4792fdefbcea023877c931cbdc15dd38963
Log:
fix bug #75540 Segfault with libzip 1.3.1
Bugs:
https://bugs.php.net/75540
Changed paths:
M ext/zip/php_zip.c
Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 45bf8af..f439340 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1514,7 +1514,10 @@ static ZIPARCHIVE_METHOD(close)
if ((err = zip_close(intern))) {
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
+#if LIBZIP_VERSION_MAJOR < 1 || (LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR <
3) || (LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 &&
LIBZIP_VERSION_MICRO < 1)
+ /* Fix memory leak in libzip < 1.3.1 */
zip_discard(intern);
+#endif
}
efree(ze_obj->filename);