From: teawater <teawater@gmail.com>
To: "Michael Snyder" <msnyder@specifix.com>
Cc: gdb@sourceware.org
Subject: Re: [patch]: Fix memory leak of target-descriptions.c
Date: Fri, 04 Jul 2008 06:40:00 -0000 [thread overview]
Message-ID: <daef60380807032339y347267dfi2db045566a490cd6@mail.gmail.com> (raw)
In-Reply-To: <1215126917.3549.74.camel@localhost.localdomain>
Michael, Thank you very much.
teawater
On Fri, Jul 4, 2008 at 07:15, Michael Snyder <msnyder@specifix.com> wrote:
> On Mon, 2008-06-30 at 16:58 +0800, teawater wrote:
>> target-descriptions.c has a memory leek in function
>> maint_print_c_tdesc_cmd. char *function is xmalloc at line 1016.
>> There are returns at the end of this function without calling free.
>> And this variable is just used in this function. So I change it to
>> "alloca".
>> This patch is for the GDB cvs version.
>>
>> 2008-06-21 Hui Zhu <teawater@gmail.com>
>> * target-descriptions.c (maint_print_c_tdesc_cmd): Fix a memory leak.
>>
>> --- a/gdb/target-descriptions.c
>> +++ b/gdb/target-descriptions.c
>> @@ -1013,7 +1013,7 @@ maint_print_c_tdesc_cmd (char *args, int
>> error (_("The current target description did not come from an XML file."));
>>
>> filename = lbasename (target_description_filename);
>> - function = xmalloc (strlen (filename) + 1);
>> + function = alloca (strlen (filename) + 1);
>> for (inp = filename, outp = function; *inp != '\0'; inp++)
>> if (*inp == '.')
>> break;
>
> This looks right to me -- committed.
>
>
>
>
prev parent reply other threads:[~2008-07-04 6:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-30 8:58 teawater
2008-07-03 23:15 ` Michael Snyder
2008-07-04 6:40 ` teawater [this message]
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=daef60380807032339y347267dfi2db045566a490cd6@mail.gmail.com \
--to=teawater@gmail.com \
--cc=gdb@sourceware.org \
--cc=msnyder@specifix.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