From: Greg Beaver Date: Sat, 10 Dec 2005 23:19:32 +0000 (+0000) Subject: fix minor leak on zlib error, new test for gzipped internal file X-Git-Tag: RELEASE_1_0_4~428 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=285b5a934e1780916dac48fd13ee49f2213c0fec;p=php fix minor leak on zlib error, new test for gzipped internal file --- diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 38104e1488..196b44ee11 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -657,6 +657,7 @@ PHP_PHAR_API php_stream * php_stream_phar_url_wrapper(php_stream_wrapper *wrappe efree(savebuf); efree(idata->file); efree(idata); + efree(internal_file); php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: %s", zError(status)); return NULL; } diff --git a/ext/phar/tests/015.phpt b/ext/phar/tests/015.phpt new file mode 100644 index 0000000000..47d9d50ba4 --- /dev/null +++ b/ext/phar/tests/015.phpt @@ -0,0 +1,20 @@ +--TEST-- +PHP_Archive::mapPhar valid file (gzipped) +--SKIPIF-- + +--FILE-- +"; +$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 11); +$file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . chr(75) . chr(4) . chr(0); // 'a' gzdeflated +file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); +include dirname(__FILE__) . '/008_phar.php'; +echo file_get_contents('phar://hio/a'); +?> +--EXPECT-- +a \ No newline at end of file