Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19561 invoked by uid 1010); 26 Nov 2003 23:10:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19537 invoked from network); 26 Nov 2003 23:10:25 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 26 Nov 2003 23:10:25 -0000 Received: from [192.168.1.100] (p508E93AA.dip.t-dialin.net [80.142.147.170]) by shiva.mind.de (Postfix) with ESMTP id 0D82197B64; Thu, 27 Nov 2003 00:10:19 +0100 (CET) Date: Thu, 27 Nov 2003 00:10:28 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <91365719859.20031127001028@marcus-boerger.de> To: Robert Twitty Cc: internals@lists.php.net In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Concern about changing zval's passed by reference From: helly@php.net (Marcus Boerger) 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