diff options
author | foobar <sniper@php.net> | 2003-03-07 00:28:25 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2003-03-07 00:28:25 +0000 |
commit | 66052056c7e71284d35ca5991d002034804dfc41 (patch) | |
tree | 056d121dee3ec167911efbf57dfaaf1a0cf4eb56 | |
parent | 4a152cad0c1df1ee047d71fbe1c154f33cc7826d (diff) | |
download | php-git-66052056c7e71284d35ca5991d002034804dfc41.tar.gz |
Better fix for the memleaks (bug 19943) by Moriyoshi
-rw-r--r-- | Zend/zend_execute.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0472d193fc..ffa61307d5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -466,10 +466,20 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 } T->EA.data.str_offset.str->value.str.val[T->EA.data.str_offset.offset] = final_value->value.str.val[0]; - if (op2 - && op2->op_type != IS_VAR - && final_value == &T(op2->u.var).tmp_var) { - STR_FREE(final_value->value.str.val); + + if (op2) { + if (op2->op_type == IS_VAR) { + if (value == &T(op2->u.var).tmp_var) { + STR_FREE(value->value.str.val); + } + } else { + if (final_value == &T(op2->u.var).tmp_var) { + /* we can safely free final_value here + * because separation is done only + * in case op2->op_type == IS_VAR */ + STR_FREE(final_value->value.str.val); + } + } } if (final_value == &tmp) { zval_dtor(final_value); |