Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] completer.c (expression_completer): Stop memory leak.
@ 2011-03-09 20:07 Michael Snyder
  2011-03-09 20:29 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2011-03-09 20:07 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

In this case, it is possible for fieldname to be allocated before an 
exception is thrown.

OK?


[-- Attachment #2: completer.txt --]
[-- Type: text/plain, Size: 678 bytes --]

2011-03-09  Michael Snyder  <msnyder@msnyder-server.eng.vmware.com>

	* completer.c (expression_completer): Stop memory leak.

Index: completer.c
===================================================================
RCS file: /cvs/src/src/gdb/completer.c,v
retrieving revision 1.44
diff -u -p -r1.44 completer.c
--- completer.c	26 Feb 2011 02:07:07 -0000	1.44
+++ completer.c	9 Mar 2011 18:56:24 -0000
@@ -455,7 +455,10 @@ expression_completer (struct cmd_list_el
       type = parse_field_expression (text, &fieldname);
     }
   if (except.reason < 0)
-    return NULL;
+    {
+      free (fieldname);
+      return NULL;
+    }
   if (fieldname && type)
     {
       for (;;)

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

end of thread, other threads:[~2011-03-09 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 20:07 [RFA] completer.c (expression_completer): Stop memory leak Michael Snyder
2011-03-09 20:29 ` Pedro Alves
2011-03-09 23:58   ` Michael Snyder
2011-03-10  0:14     ` Pedro Alves

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