Re: free_zval not working?
| From: | Andi Gutmans | Date: | Tue, 22 Jan 2002 17:50:23 +0000 |
| Subject: | Re: free_zval not working? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-77799@lists.php.net to get a copy of this message | ||
On Tue, 22 Jan 2002, Thies C. Arntzen wrote:
> On Tue, Jan 22, 2002 at 09:27:53AM +0100, Robin Ericsson wrote:
> > I'm using this on php 4.0.6, it know it's old, but things will break if
> > I upgrade :)
> >
> > This is the code:
> >
> > zval *z_return;
> > MAKE_STD_ZVAL(z_return);
> >
> > php_char_to_str(retval, strlen(retval), '\n', "<br>\n", 5,
> > z_return);
> >
> > FREE_ZVAL(z_return);
> >
> >
> > This code gives me:
> > string.c(2122) : Freeing 0x08257CEC (134 bytes), script=nn.php
> >
> > which is the new string allocated inside php_char_to_str(), howcome this
> > memory isn't freed with FREE_ZVAL?
>
> FREE_ZVAL only frees the zval and does not destroy (read
> =free) the attached data-structures. use zval_dtor for that.
You should use zval_ptr_dtor() and not zval_dtor().
Andi