This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Memory leak
- To: gdb-patches at sources dot redhat dot com
- Subject: Memory leak
- From: Andreas Schwab <schwab at suse dot de>
- Date: 12 Nov 2001 17:54:19 +0100
This patch fixes a memory leak.
Andreas.
2001-11-12 Andreas Schwab <schwab@suse.de>
* 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