Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] fixed the memory leak in record.c
@ 2009-08-27  5:26 Jiang Jilin
  2009-08-27  6:34 ` Hui Zhu
  2009-08-27 18:28 ` Michael Snyder
  0 siblings, 2 replies; 7+ messages in thread
From: Jiang Jilin @ 2009-08-27  5:26 UTC (permalink / raw)
  To: teawater; +Cc: gdb-patches, Jiang Jilin

	* 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


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-27  5:26 [PATCH] fixed the memory leak in record.c Jiang Jilin
@ 2009-08-27  6:34 ` Hui Zhu
  2009-08-28  1:35   ` Hui Zhu
  2009-08-27 18:28 ` Michael Snyder
  1 sibling, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2009-08-27  6:34 UTC (permalink / raw)
  To: Jiang Jilin, gdb-patches ml

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
>
>

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);


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-27  5:26 [PATCH] fixed the memory leak in record.c Jiang Jilin
  2009-08-27  6:34 ` Hui Zhu
@ 2009-08-27 18:28 ` Michael Snyder
  2009-08-28  0:58   ` Jiang Jilin
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2009-08-27 18:28 UTC (permalink / raw)
  To: Jiang Jilin; +Cc: teawater, gdb-patches

Jiang Jilin wrote:
> 	* record.c (record_list_release_next) : fixed memory leak when record type is record_reg
> 
> Signed-off-by: Jiang Jilin <freephp@gmail.com>

Looks correct to me, though I'd like to hear "ok" from Hui Zhu too.

The change is short enough to accept without a copyright assignment.

For future reference, we like to see a full ChangeLog entry with a 
header that would look something like this (it's ok this time):

2009-08-27  Jiang Jilin  <freephp@gmail.com>

	* record.c (...): ...

Thank you!

> ---
>  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);


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-27 18:28 ` Michael Snyder
@ 2009-08-28  0:58   ` Jiang Jilin
  0 siblings, 0 replies; 7+ messages in thread
From: Jiang Jilin @ 2009-08-28  0:58 UTC (permalink / raw)
  To: Michael Snyder; +Cc: teawater, gdb-patches

On 8/28/09, Michael Snyder <msnyder@vmware.com> wrote:
> Jiang Jilin wrote:
>> 	* record.c (record_list_release_next) : fixed memory leak when record
>> type is record_reg
>>
>> Signed-off-by: Jiang Jilin <freephp@gmail.com>
>
> Looks correct to me, though I'd like to hear "ok" from Hui Zhu too.

Sorry, my patch is not OK, and Hui has added a new patch. But he
hasn't checked in his new patch.

> The change is short enough to accept without a copyright assignment.
>
> For future reference, we like to see a full ChangeLog entry with a
> header that would look something like this (it's ok this time):
>
> 2009-08-27  Jiang Jilin  <freephp@gmail.com>
>
> 	* record.c (...): ...
>
> Thank you!

I got it, thank you!


>> ---
>>  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);
>
>


-- 
Regards,

Jiang


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-27  6:34 ` Hui Zhu
@ 2009-08-28  1:35   ` Hui Zhu
  2009-08-28  1:57     ` Michael Snyder
  0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2009-08-28  1:35 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Jiang Jilin, gdb-patches ml

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?

Thanks,
Hui

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);


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-28  1:35   ` Hui Zhu
@ 2009-08-28  1:57     ` Michael Snyder
  2009-08-28  3:05       ` Hui Zhu
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Snyder @ 2009-08-28  1:57 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Jiang Jilin, gdb-patches ml

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);


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

* Re: [PATCH] fixed the memory leak in record.c
  2009-08-28  1:57     ` Michael Snyder
@ 2009-08-28  3:05       ` Hui Zhu
  0 siblings, 0 replies; 7+ messages in thread
From: Hui Zhu @ 2009-08-28  3:05 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Jiang Jilin, gdb-patches ml

On Fri, Aug 28, 2009 at 09:45, Michael Snyder<msnyder@vmware.com> wrote:
> 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.

Checked in.  Thank you, Michael and Jilin.

Hui


>
>> 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);
>
>


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

end of thread, other threads:[~2009-08-28  2:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-27  5:26 [PATCH] fixed the memory leak in record.c Jiang Jilin
2009-08-27  6:34 ` Hui Zhu
2009-08-28  1:35   ` Hui Zhu
2009-08-28  1:57     ` Michael Snyder
2009-08-28  3:05       ` Hui Zhu
2009-08-27 18:28 ` Michael Snyder
2009-08-28  0:58   ` Jiang Jilin

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