Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix memory leak in break command
@ 2005-01-03 13:49 Andreas Schwab
  2005-01-04  4:45 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2005-01-03 13:49 UTC (permalink / raw)
  To: gdb-patches

Found this by code inspection.

Andreas.

2005-01-03  Andreas Schwab  <schwab@suse.de>

	* breakpoint.c (break_command_1): Always free err_msg before
	returning when an exception was caught.

Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.186
diff -u -p -a -u -p -a -r1.186 gdb/breakpoint.c
--- gdb/breakpoint.c	1 Dec 2004 06:54:56 -0000	1.186
+++ gdb/breakpoint.c	3 Jan 2005 13:45:20 -0000
@@ -5141,7 +5141,10 @@ break_command_1 (char *arg, int flag, in
 	{
 	  /* If called to resolve pending breakpoint, just return error code.  */
 	  if (pending_bp)
-	    return rc;
+	    {
+	      xfree (err_msg);
+	      return rc;
+	    }
 
 	  error_output_message (NULL, err_msg);
 	  xfree (err_msg);
@@ -5169,7 +5172,10 @@ break_command_1 (char *arg, int flag, in
 	  pending = 1;
 	}
       else
-	return rc;
+	{
+	  xfree (err_msg);
+	  return rc;
+	}
     }
   else if (!sals.nelts)
     return GDB_RC_FAIL;

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

end of thread, other threads:[~2005-01-04  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-03 13:49 Fix memory leak in break command Andreas Schwab
2005-01-04  4:45 ` Eli Zaretskii

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