From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3237 invoked by alias); 28 Aug 2002 17:33:28 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3229 invoked from network); 28 Aug 2002 17:33:27 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 28 Aug 2002 17:33:27 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17k7dH-0004mb-00; Wed, 28 Aug 2002 13:33:35 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17k6i6-0001Xk-00; Wed, 28 Aug 2002 13:34:30 -0400 Date: Wed, 28 Aug 2002 11:36:00 -0000 From: Daniel Jacobowitz To: David Carlton Cc: gdb-patches@sources.redhat.com, ezannoni@redhat.com Subject: Re: RFA: Correct field names for class methods Message-ID: <20020828173429.GA5873@nevyn.them.org> Mail-Followup-To: David Carlton , gdb-patches@sources.redhat.com, ezannoni@redhat.com References: <20020827031346.GA16591@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2002-08/txt/msg00948.txt.bz2 On Wed, Aug 28, 2002 at 10:23:06AM -0700, David Carlton wrote: > In article <20020827031346.GA16591@nevyn.them.org>, Daniel Jacobowitz > writes: > > > +void > > +update_method_name_from_physname (char **old_name, char *physname) > > +{ > > + char *method_name; > > + > > + method_name = method_name_from_physname (physname); > > + > > + if (method_name == NULL) > > + error ("bad physname %s\n", physname); > > + > > + if (strcmp (*old_name, method_name) != 0) > > + *old_name = method_name; > > + else > > + xfree (method_name); > > +} > > I'm pretty sure this is a memory leak. How about replacing the last > if clause by > > xfree(*old_name); > *old_name = method_name; > > That should get rid of the memory leak and avoid a superfluous > strcmp. No can do. Look at where TYPE_NAME is allocated; sometimes (often? Not sure.) it is on the obstack. We're not consistent about that. We need to be, someday, but that's a separate cleanup. > (Also, the ChangeLog entry has the name of this function written > incorrectly.) Oops, thanks! -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer