cvs: pecl /phar phar.c /phar/tests bug46178.phpt
| From: | Greg Beaver | Date: | Fri, 26 Sep 2008 16:30:24 +0000 |
| Subject: | cvs: pecl /phar phar.c /phar/tests bug46178.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-11390@lists.php.net to get a copy of this message | ||
cellog Fri Sep 26 16:30:24 2008 UTC
Added files:
/pecl/phar/tests bug46178.phpt
Modified files:
/pecl/phar phar.c
Log:
MFPHP5: fix bug #46178: memory leak in ext/phar
http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.377&r2=1.378&diff_format=u
Index: pecl/phar/phar.c
diff -u pecl/phar/phar.c:1.377 pecl/phar/phar.c:1.378
--- pecl/phar/phar.c:1.377 Sat Sep 13 22:31:11 2008
+++ pecl/phar/phar.c Fri Sep 26 16:30:24 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar.c,v 1.377 2008/09/13 22:31:11 cellog Exp $ */
+/* $Id: phar.c,v 1.378 2008/09/26 16:30:24 cellog Exp $ */
#define PHAR_MAIN 1
#include "phar_internal.h"
@@ -440,6 +440,11 @@
if (idata->fp && idata->fp != idata->phar->fp && idata->fp !=
idata->phar->ufp && idata->fp != idata->internal_file->fp) {
php_stream_close(idata->fp);
}
+ /* if phar_get_or_create_entry_data returns a sub-directory, we have to free it */
+ if (idata->internal_file->is_temp_dir) {
+ destroy_phar_manifest_entry((void *)idata->internal_file);
+ efree(idata->internal_file);
+ }
}
phar_archive_delref(idata->phar TSRMLS_CC);
@@ -3613,7 +3618,7 @@
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
- php_info_print_table_row(2, "CVS revision", "$Revision: 1.377 $");
+ php_info_print_table_row(2, "CVS revision", "$Revision: 1.378 $");
php_info_print_table_row(2, "Phar-based phar archives", "enabled");
php_info_print_table_row(2, "Tar-based phar archives", "enabled");
php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
http://cvs.php.net/viewvc.cgi/pecl/phar/tests/bug46178.phpt?view=markup&rev=1.1
Index: pecl/phar/tests/bug46178.phpt
+++ pecl/phar/tests/bug46178.phpt
--TEST--
Phar: PHP bug #46178: "memory leak in ext/phar"
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') .
'.phar';
$phar = new Phar($fname);
$phar['long/path/name.txt'] = 'hi';
$phar->addEmptyDir('long/path');
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') .
'.phar');?>
--EXPECT--
===DONE===