From c532376ee78342fb170c5d2b7784b3ab79491494 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 11 Mar 2015 15:26:33 +0100 Subject: [PATCH] Fix some memory leaks in WebPhar --- ext/phar/phar_object.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 69bda4bab3..e276613209 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -819,6 +819,11 @@ PHP_METHOD(Phar, webPhar) code = Z_LVAL_P(val); } else { zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed"); + if (free_pathinfo) { + efree(path_info); + } + efree(pt); + efree(entry); #ifdef PHP_WIN32 efree(fname); #endif @@ -831,6 +836,11 @@ PHP_METHOD(Phar, webPhar) break; default: zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed"); + if (free_pathinfo) { + efree(path_info); + } + efree(pt); + efree(entry); #ifdef PHP_WIN32 efree(fname); #endif -- 2.40.0