From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Vladimir Prus <vladimir@codesourcery.com>
Subject: [RFA] mi-cmd-disas.c (mi_cmd_disassemble): Fix memory leak.
Date: Wed, 09 Mar 2011 20:18:00 -0000 [thread overview]
Message-ID: <4D77D0D9.8030202@vmware.com> (raw)
[-- 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);
}
next reply other threads:[~2011-03-09 19:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-09 20:18 Michael Snyder [this message]
2011-03-09 22:14 ` Vladimir Prus
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=4D77D0D9.8030202@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb-patches@sourceware.org \
--cc=vladimir@codesourcery.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