]> granicus.if.org Git - php/commitdiff
Fix some memory leaks in WebPhar
authorNikita Popov <nikic@php.net>
Wed, 11 Mar 2015 14:26:33 +0000 (15:26 +0100)
committerNikita Popov <nikic@php.net>
Wed, 11 Mar 2015 14:27:42 +0000 (15:27 +0100)
ext/phar/phar_object.c

index 69bda4bab3e5f8022e291c7af4b53895666e0300..e276613209f050e9e4d64ac6ee4a89c697b75bc6 100644 (file)
@@ -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