Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sources.redhat.com
Subject: Memory leak
Date: Thu, 01 Nov 2001 14:28:00 -0000	[thread overview]
Message-ID: <jeeln4szes.fsf@sykes.suse.de> (raw)

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


             reply	other threads:[~2001-11-12 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01 14:28 Andreas Schwab [this message]
2001-11-01 19:31 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jeeln4szes.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox