From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28633 invoked by alias); 14 Feb 2002 11:36:43 -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 28548 invoked from network); 14 Feb 2002 11:36:34 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.7) by sources.redhat.com with SMTP; 14 Feb 2002 11:36:34 -0000 Received: from laocoon (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (8.9.3/8.8.7) with ESMTP id MAA21498 for ; Thu, 14 Feb 2002 12:36:32 +0100 Message-Id: <4.2.0.58.20020214123355.0169bfe0@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Thu, 14 Feb 2002 03:36:00 -0000 To: gdb-patches@sources.redhat.com From: Pierre Muller Subject: Re: [RFA] win32-nat printf and sprintf removal In-Reply-To: <4.2.0.58.20020214121240.01a80208@ics.u-strasbg.fr> References: <20020208230440.GA8444@redhat.com> <4.2.0.58.20020208182442.00ad05e0@ics.u-strasbg.fr> <4.2.0.58.20020208182442.00ad05e0@ics.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2002-02/txt/msg00404.txt.bz2 > > >@@ -2009,7 +2009,7 @@ _initialize_check_for_gdb_ini (void) > > > { > > > int len = strlen (oldini); > > > char *newini = alloca (len + 1); > > >- sprintf (newini, "%.*s.gdbinit", > > >+ xasprintf (newini, "%.*s.gdbinit", > > > (int) (len - (sizeof ("gdb.ini") - 1)), oldini); > > > warning ("obsolete '%s' found. Rename to '%s'.", oldini, newini); > > > } > > I corrected this one to this patch, >which doesn't give any warning. >But the memory allocated for oldini is still lost.... Whoops, once again, I clearly show my lack of C knowledge.... oldini is set by using alloca, and I just discovered that alloca function does automatic disposal of the memory allocated at function exit. Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99