[PHP-CVS] com php-src: Fixed bug #66334 (Memory Leak in new pass1_5.c optimizations). (Terry): ext/opcache/Optimizer/pass1_5.c ext/opcache/tests/bug66334.phpt
Commit:ccb29a6e41afc3a5ced31e86951fca5119a2e8d0 Author:Dmitry Stogov dmi...@zend.com Mon, 23 Dec 2013 16:04:10 +0400 Parents: 8650d2dda65cf7ac70bf83323ca8036d01dbe349 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ccb29a6e41afc3a5ced31e86951fca5119a2e8d0 Log: Fixed bug #66334 (Memory Leak in new pass1_5.c optimizations). (Terry) Bugs: https://bugs.php.net/66334 Changed paths: M ext/opcache/Optimizer/pass1_5.c A ext/opcache/tests/bug66334.phpt Diff: diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 4601562..5ab5bf4 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -383,9 +383,11 @@ if (ZEND_OPTIMIZER_PASS_1 OPTIMIZATION_LEVEL) { zend_module_entry *m; char *lc_name = zend_str_tolower_dup( Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline - 1))); + int found = zend_hash_find(module_registry, + lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)m) == SUCCESS; - if (zend_hash_find(module_registry, - lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)m) == FAILURE) { + efree(lc_name); + if (!found) { if (!PG(enable_dl)) { break; } else { @@ -405,7 +407,6 @@ if (ZEND_OPTIMIZER_PASS_1 OPTIMIZATION_LEVEL) { literal_dtor(ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } - efree(lc_name); } else if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof(defined)-1 !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), defined, sizeof(defined)-1)) { diff --git a/ext/opcache/tests/bug66334.phpt b/ext/opcache/tests/bug66334.phpt new file mode 100644 index 000..b2c6d7b --- /dev/null +++ b/ext/opcache/tests/bug66334.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #66334 (Memory Leak in new pass1_5.c optimizations) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +enable_dl=0 +--SKIPIF-- +?php require_once('skipif.inc'); ? +--FILE-- +?php +if (extension_loaded(unknown_extension)) { + var_dump(1); +} else { + var_dump(2); +} +--EXPECT-- +int(2) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #66334 (Memory Leak in new pass1_5.c optimizations). (Terry): ext/opcache/Optimizer/pass1_5.c ext/opcache/tests/bug66334.phpt
Commit:c699696c438eeb3214d3a645110d03f98f8e979e Author:Dmitry Stogov dmi...@zend.com Mon, 23 Dec 2013 16:04:10 +0400 Committer: Anatol Belski a...@php.net Mon, 23 Dec 2013 20:30:27 +0100 Parents: 8d64f0ee711b00c0fdda37e8e55615b0d2510269 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c699696c438eeb3214d3a645110d03f98f8e979e Log: Fixed bug #66334 (Memory Leak in new pass1_5.c optimizations). (Terry) Bugs: https://bugs.php.net/66334 Changed paths: M ext/opcache/Optimizer/pass1_5.c A ext/opcache/tests/bug66334.phpt Diff: diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 9de8590..68db08a 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -383,9 +383,11 @@ if (ZEND_OPTIMIZER_PASS_1 OPTIMIZATION_LEVEL) { zend_module_entry *m; char *lc_name = zend_str_tolower_dup( Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1))); + int found = zend_hash_find(module_registry, + lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)m) == SUCCESS; - if (zend_hash_find(module_registry, - lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline - 1)) + 1, (void *)m) == FAILURE) { + efree(lc_name); + if (!found) { if (!PG(enable_dl)) { break; } else { @@ -405,7 +407,6 @@ if (ZEND_OPTIMIZER_PASS_1 OPTIMIZATION_LEVEL) { literal_dtor(ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); } - efree(lc_name); } else if (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) == sizeof(defined)-1 !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), defined, sizeof(defined)-1)) { diff --git a/ext/opcache/tests/bug66334.phpt b/ext/opcache/tests/bug66334.phpt new file mode 100644 index 000..b2c6d7b --- /dev/null +++ b/ext/opcache/tests/bug66334.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #66334 (Memory Leak in new pass1_5.c optimizations) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.file_update_protection=0 +enable_dl=0 +--SKIPIF-- +?php require_once('skipif.inc'); ? +--FILE-- +?php +if (extension_loaded(unknown_extension)) { + var_dump(1); +} else { + var_dump(2); +} +--EXPECT-- +int(2) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php