From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8074 invoked by alias); 12 Nov 2001 21:22:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7190 invoked from network); 12 Nov 2001 21:20:41 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sourceware.cygnus.com with SMTP; 12 Nov 2001 21:20:41 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id B6E905E9D8; Mon, 12 Nov 2001 16:21:55 -0500 (EST) To: Andreas Schwab Cc: gdb-patches@sources.redhat.com Subject: Re: Memory leak References: From: Jim Blandy Date: Thu, 01 Nov 2001 19:31:00 -0000 In-Reply-To: Andreas Schwab's message of 12 Nov 2001 17:54:19 +0100 Message-ID: X-Mailer: Gnus v5.3/Emacs 19.34 X-SW-Source: 2001-11/txt/msg00017.txt.bz2 I've committed this change --- thanks! Andreas Schwab writes: > > This patch fixes a memory leak. > > Andreas. > > 2001-11-12 Andreas Schwab > > * eval.c (evaluate_subexp_standard): Fix memory leak: use alloca > instead of xmalloc. > > Index: eval.c > =================================================================== > RCS file: /cvs/src/src/gdb/eval.c,v > retrieving revision 1.15 > diff -u -a -u -r1.15 eval.c > --- eval.c 2001/11/10 20:15:13 1.15 > +++ eval.c 2001/11/12 16:50:12 > @@ -839,7 +839,7 @@ > struct value *valp = NULL; > > /* Prepare list of argument types for overload resolution */ > - arg_types = (struct type **) xmalloc (nargs * (sizeof (struct type *))); > + arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); > for (ix = 1; ix <= nargs; ix++) > arg_types[ix - 1] = VALUE_TYPE (argvec[ix]); > > @@ -888,7 +888,7 @@ > struct symbol *symp; > > /* Prepare list of argument types for overload resolution */ > - arg_types = (struct type **) xmalloc (nargs * (sizeof (struct type *))); > + arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); > for (ix = 1; ix <= nargs; ix++) > arg_types[ix - 1] = VALUE_TYPE (argvec[ix]); > > > -- > Andreas Schwab "And now for something > Andreas.Schwab@suse.de completely different." > SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg > Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 >