Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Jiang Jilin <freephp@gmail.com>,
	  gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH] fixed the memory leak in record.c
Date: Fri, 28 Aug 2009 01:57:00 -0000	[thread overview]
Message-ID: <4A9736B4.4020008@vmware.com> (raw)
In-Reply-To: <daef60380908271824v4d3792d0wc0a1806a19b41e1f@mail.gmail.com>

Hui Zhu wrote:
> On Thu, Aug 27, 2009 at 13:35, Hui Zhu<teawater@gmail.com> wrote:
>> On Thu, Aug 27, 2009 at 11:11, Jiang Jilin<freephp@gmail.com> wrote:
>>>        * record.c (record_list_release_next) : fixed memory leak when record type is record_reg
>>>
>>> Signed-off-by: Jiang Jilin <freephp@gmail.com>
>>> ---
>>>  gdb/record.c |    7 ++++---
>>>  1 files changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/gdb/record.c b/gdb/record.c
>>> index 8afca6b..07e9e80 100644
>>> --- a/gdb/record.c
>>> +++ b/gdb/record.c
>>> @@ -158,9 +158,10 @@ record_list_release_next (void)
>>>     {
>>>       rec = tmp->next;
>>>       if (tmp->type == record_reg)
>>> -       record_insn_num--;
>>> -      else if (tmp->type == record_reg)
>>> -       xfree (tmp->u.reg.val);
>>> +       {
>>> +         record_insn_num--;
>>> +         xfree (tmp->u.reg.val);
>>> +       }
>>>       else if (tmp->type == record_mem)
>>>        xfree (tmp->u.mem.val);
>>>       xfree (tmp);
>>> --
>>> 1.5.4.3
>>>
>>>
> 
> Hi Michael,
> 
> Could you please help me review this patch?

Yes, I think it looks fine.  Please commit.

> Following is my patch:
> 
>> Cool.  Thanks for find it out.  :)
>> But this patch is not OK.  This record_reg should be record_end.
>>
>> I make a patch for it.
>>
>> Thanks,
>> Hui
>>
>> 2009-08-27  Hui Zhu  <teawater@gmail.com>
>>
>>        * record.c (record_list_release_next): Change the first
>>        record_reg to record_end.
>>
> ---
>  record.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/record.c
> +++ b/record.c
> @@ -157,7 +157,7 @@ record_list_release_next (void)
>    while (tmp)
>      {
>        rec = tmp->next;
> -      if (tmp->type == record_reg)
> +      if (tmp->type == record_end)
>  	record_insn_num--;
>        else if (tmp->type == record_reg)
>  	xfree (tmp->u.reg.val);


  reply	other threads:[~2009-08-28  1:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27  5:26 Jiang Jilin
2009-08-27  6:34 ` Hui Zhu
2009-08-28  1:35   ` Hui Zhu
2009-08-28  1:57     ` Michael Snyder [this message]
2009-08-28  3:05       ` Hui Zhu
2009-08-27 18:28 ` Michael Snyder
2009-08-28  0:58   ` Jiang Jilin

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=4A9736B4.4020008@vmware.com \
    --to=msnyder@vmware.com \
    --cc=freephp@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=teawater@gmail.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