Re: Concern about changing zval's passed by reference
| From: | Robert Twitty | Date: | Thu, 27 Nov 2003 18:14:26 +0000 |
| Subject: | Re: Concern about changing zval's passed by reference | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-5780@lists.php.net to get a copy of this message | ||
hanks Marcus
zval_dtor is what I need.
-- bob
On Thu, 27 Nov 2003, Marcus Boerger wrote:
> Hello Robert,
>
> Wednesday, November 26, 2003, 11:32:48 PM, you wrote:
>
> > Hello
>
> > I am using the macros ZVAL_BOOL, ZVAL_LONG, ZVAL_DOUBLE and ZVAL_STRING to
> > change the value of a zval passed by reference. I noticed that these
> > macros do not free the original value if it's a string, array, object or
> > resource prior to the change. This causes a possible memory leak. Is
> > this a normal practice? And, if not, what is the accepted practice for
> > changing zval's passed by reference?
>
> You need to free the value prior to overwriting it by zval_dtor() or you
> need to use the appropriate zval change macro.
>
> --
> Best regards,
> Marcus mailto:helly@php.net
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>