]> granicus.if.org Git - php/commitdiff
Fixed bug #40899 (memory leak when nesting list())
authorDmitry Stogov <dmitry@php.net>
Fri, 23 Mar 2007 12:46:38 +0000 (12:46 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 23 Mar 2007 12:46:38 +0000 (12:46 +0000)
Zend/tests/bug40899.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug40899.phpt b/Zend/tests/bug40899.phpt
new file mode 100644 (file)
index 0000000..7be0f6b
--- /dev/null
@@ -0,0 +1,9 @@
+--TEST--
+Bug #40899 (memory leak when nesting list())
+--FILE--
+<?php
+list(list($a,$b),$c)=array(array('a','b'),'c');
+echo "$a$b$c\n";
+?>
+--EXPECT--
+abc
index 7f25c323eb98b22bb539ae0f00d0ac9c54dc843f..0bd9586c64b66a55fc59a8fa7b822511fcc2277a 100644 (file)
@@ -3657,6 +3657,7 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
                                                opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
                                                break;
                                }
+                               opline->extended_value = ZEND_FETCH_ADD_LOCK;
                        } else {
                                opline->opcode = ZEND_FETCH_DIM_R;
                        }
@@ -3668,7 +3669,6 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
                        Z_TYPE(opline->op2.u.constant) = IS_LONG;
                        Z_LVAL(opline->op2.u.constant) = *((int *) dimension->data);
                        INIT_PZVAL(&opline->op2.u.constant);
-                       opline->extended_value = ZEND_FETCH_ADD_LOCK;
                        last_container = opline->result;
                        dimension = dimension->next;
                }