* [RFA] mi-cmd-disas.c (mi_cmd_disassemble): Fix memory leak.
@ 2011-03-09 20:18 Michael Snyder
2011-03-09 22:14 ` Vladimir Prus
0 siblings, 1 reply; 2+ messages in thread
From: Michael Snyder @ 2011-03-09 20:18 UTC (permalink / raw)
To: gdb-patches, Vladimir Prus
[-- Attachment #1: Type: text/plain, Size: 5 bytes --]
OK?
[-- Attachment #2: mi-cmd-disas.txt --]
[-- Type: text/plain, Size: 1040 bytes --]
2011-03-09 Michael Snyder <msnyder@vmware.com>
* mi-cmd-disas.c (mi_cmd_disassemble): Fix memory leak.
Index: mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.38
diff -u -p -r1.38 mi-cmd-disas.c
--- mi-cmd-disas.c 12 Jan 2011 21:09:39 -0000 1.38
+++ mi-cmd-disas.c 9 Mar 2011 19:08:54 -0000
@@ -73,6 +73,7 @@ mi_cmd_disassemble (char *command, char
int how_many = -1;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
/* Options processing stuff. */
int optind = 0;
@@ -103,6 +104,7 @@ mi_cmd_disassemble (char *command, char
case FILE_OPT:
file_string = xstrdup (optarg);
file_seen = 1;
+ make_cleanup (xfree, file_string);
break;
case LINE_OPT:
line_num = atoi (optarg);
@@ -169,4 +171,6 @@ mi_cmd_disassemble (char *command, char
file_string,
disasm_flags,
how_many, low, high);
+
+ do_cleanups (cleanups);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-09 20:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 20:18 [RFA] mi-cmd-disas.c (mi_cmd_disassemble): Fix memory leak Michael Snyder
2011-03-09 22:14 ` Vladimir Prus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox