Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Memory leak
@ 2001-11-01 14:28 Andreas Schwab
  2001-11-01 19:31 ` Jim Blandy
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2001-11-01 14:28 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-11-12 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-01 14:28 Memory leak Andreas Schwab
2001-11-01 19:31 ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox