com php-src: Fixed bug #67368 (Memory leak with immediately dereferenced array in class constant): NEWS Zend/tests/bug67368.phpt Zend/zend_ast.c

From: Date: Tue, 24 Jun 2014 05:53:05 +0000
Subject: com php-src: Fixed bug #67368 (Memory leak with immediately dereferenced array in class constant): NEWS Zend/tests/bug67368.phpt Zend/zend_ast.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79032@lists.php.net to get a copy of this message
Commit: 9d49492fd66cce4d62ad57aa29ef3b6ae076e1ef Author: Xinchen Hui <laruence@php.net> Tue, 24 Jun 2014 13:53:05 +0800 Parents: 6b8cef7847f49ef142e6593fd9bb9172d18b073a Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9d49492fd66cce4d62ad57aa29ef3b6ae076e1ef Log: Fixed bug #67368 (Memory leak with immediately dereferenced array in class constant) Bugs: https://bugs.php.net/67368 Changed paths: M NEWS A Zend/tests/bug67368.phpt M Zend/zend_ast.c Diff: diff --git a/NEWS b/NEWS index 693486b..373f810 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2014, PHP 5.6.0 Release Candidate 2 - Core: + . Fixed bug #67368 (Memory leak with immediately dereferenced array in class + constant). (Laruence) . Fixed bug #67468 (Segfault in highlight_file()/highlight_string()). (Andreas Ferber) diff --git a/Zend/tests/bug67368.phpt b/Zend/tests/bug67368.phpt new file mode 100644 index 0000000..c92e994 --- /dev/null +++ b/Zend/tests/bug67368.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #67368 (Memory leak with immediately dereferenced array in class constant) +--INI-- +report_memleaks=1 +--FILE-- +<?php +class FooBar { + const bar = ["bar" => 3]["bar"]; +} +echo "okey"; +--EXPECTF-- +okey diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 583a523..12f9405 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -328,8 +328,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s { zval *tmp; zend_fetch_dimension_by_zval(&tmp, &op1, &op2 TSRMLS_CC); - *result = *tmp; - efree(tmp); + ZVAL_ZVAL(result, tmp, 1, 1); } zval_dtor(&op1); zval_dtor(&op2);

« previous php.cvs (#79032) next »