summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-09-18 22:07:12 +0000
committerAndi Gutmans <andi@php.net>1999-09-18 22:07:12 +0000
commit1ac04fe9f47b1fb3ebf40ffb7f3184894e9f0100 (patch)
treeab6b20a6f1067b70c82d9536298bbfd8313a42a0 /Zend/zend_execute.c
parenta5783da8a9a70b1b265038c68d49a41e061b25c6 (diff)
downloadphp-git-1ac04fe9f47b1fb3ebf40ffb7f3184894e9f0100.tar.gz
- Try to fix the leak Rasmus reported. It's pretty sucky code so I'm really
not sure this fix is OK.I can't remember all of what we did there.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 19b95849cd..a77e4668b4 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -256,22 +256,25 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (T->EA.str->type == IS_STRING
&& (T->EA.offset < T->EA.str->value.str.len)) {
zval tmp;
+ zval *final_value = value;
if (value->type!=IS_STRING) {
tmp = *value;
- zval_copy_ctor(&tmp);
+ if (op2 && op2->op_type == IS_VAR) {
+ zval_copy_ctor(&tmp);
+ }
convert_to_string(&tmp);
- value = &tmp;
+ final_value = &tmp;
}
- T->EA.str->value.str.val[T->EA.offset] = value->value.str.val[0];
+ T->EA.str->value.str.val[T->EA.offset] = final_value->value.str.val[0];
if (op2
&& op2->op_type == IS_VAR
&& value==&Ts[op2->u.var].tmp_var) {
efree(value->value.str.val);
}
- if (value == &tmp) {
- zval_dtor(value);
+ if (final_value == &tmp) {
+ zval_dtor(final_value);
}
/*
* the value of an assignment to a string offset is undefined