Re: fix for bug #26696
| From: | Sterling Hughes | Date: | Tue, 13 Jan 2004 22:27:05 +0000 |
| Subject: | Re: fix for bug #26696 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-7072@lists.php.net to get a copy of this message | ||
Ok, attached is a diff that properly fixes the problem.
-Sterling
> At 04:06 PM 1/13/2004 -0500, Sterling Hughes wrote:
> >> Are you sure this is OK? It seems strange that string offsets don't need
> >> any unlocking. It might mean we have a problem someplace else and that
> >> you're fixing the cause and not the source of the problem (although I
> >> haven't had time to dig deep).
> >> In general, consider the following code:
> >> $a = "Foo";
> >>
> >> switch ($a[0]) {
> >> case 'b':
> >> break;
> >> case 'c':
> >> break;
> >> case 'F':
> >> break;
> >> }
> >>
> >> Are you sure this doesn't leak now? I don't have time to look at it now,
> >> but if you are absolutely convinced the patch makes sense I'll try and
> >step
> >> through it with a debugger as soon as I have some free time.
> >>
> >
> >No, I was wrong. I hate the memory manager, it cleans up my leaks for
> >me - makes it impossible to rely on valgrind. ;) Anyway to turn that off?
>
> If you're running in --enable-debug it should be telling you about the
> leaks.
>
> >I'm playing around some more now.
>
> OK thanks.
>
> Andi
>
Index: zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.583 diff -u -r1.583 zend_execute.c --- zend_execute.c 9 Jan 2004 13:52:19 -0000 1.583 +++ zend_execute.c 13 Jan 2004 22:24:18 -0000 @@ -195,11 +195,10 @@ switch (opline->op1.op_type) { case IS_VAR: if (!T(opline->op1.u.var).var.ptr_ptr) { - temp_variable *T = &T(opline->op1.u.var); /* perform the equivalent of equivalent of a * quick & silent get_zval_ptr, and FREE_OP */ - PZVAL_UNLOCK(T->var.str_offset.str); + PZVAL_UNLOCK(*Ts->var.ptr_ptr); } else { zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); if (opline->extended_value) { /* foreach() free */
Index: zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.583 diff -u -r1.583 zend_execute.c --- zend_execute.c 9 Jan 2004 13:52:19 -0000 1.583 +++ zend_execute.c 13 Jan 2004 22:24:18 -0000 @@ -195,11 +195,10 @@ switch (opline->op1.op_type) { case IS_VAR: if (!T(opline->op1.u.var).var.ptr_ptr) { - temp_variable *T = &T(opline->op1.u.var); /* perform the equivalent of equivalent of a * quick & silent get_zval_ptr, and FREE_OP */ - PZVAL_UNLOCK(T->var.str_offset.str); + PZVAL_UNLOCK(*Ts->var.ptr_ptr); } else { zval_ptr_dtor(&T(opline->op1.u.var).var.ptr); if (opline->extended_value) { /* foreach() free */