From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25544 invoked by alias); 28 Aug 2009 02:14:43 -0000 Received: (qmail 25536 invoked by uid 22791); 28 Aug 2009 02:14:42 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f202.google.com (HELO mail-pz0-f202.google.com) (209.85.222.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Aug 2009 02:14:35 +0000 Received: by pzk40 with SMTP id 40so1526069pzk.26 for ; Thu, 27 Aug 2009 19:14:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.24.42 with SMTP id b42mr24787wfj.237.1251425674080; Thu, 27 Aug 2009 19:14:34 -0700 (PDT) In-Reply-To: <4A9736B4.4020008@vmware.com> References: <1251342694-17525-1-git-send-email-freephp@gmail.com> <4A9736B4.4020008@vmware.com> From: Hui Zhu Date: Fri, 28 Aug 2009 03:05:00 -0000 Message-ID: Subject: Re: [PATCH] fixed the memory leak in record.c To: Michael Snyder Cc: Jiang Jilin , gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00506.txt.bz2 On Fri, Aug 28, 2009 at 09:45, Michael Snyder wrote: > Hui Zhu wrote: >> >> On Thu, Aug 27, 2009 at 13:35, Hui Zhu wrote: >>> >>> On Thu, Aug 27, 2009 at 11:11, Jiang Jilin wrote: >>>> >>>> =A0 =A0 =A0 * record.c (record_list_release_next) : fixed memory leak = when >>>> record type is record_reg >>>> >>>> Signed-off-by: Jiang Jilin >>>> --- >>>> =A0gdb/record.c | =A0 =A07 ++++--- >>>> =A01 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) >>>> =A0 =A0{ >>>> =A0 =A0 =A0rec =3D tmp->next; >>>> =A0 =A0 =A0if (tmp->type =3D=3D record_reg) >>>> - =A0 =A0 =A0 record_insn_num--; >>>> - =A0 =A0 =A0else if (tmp->type =3D=3D record_reg) >>>> - =A0 =A0 =A0 xfree (tmp->u.reg.val); >>>> + =A0 =A0 =A0 { >>>> + =A0 =A0 =A0 =A0 record_insn_num--; >>>> + =A0 =A0 =A0 =A0 xfree (tmp->u.reg.val); >>>> + =A0 =A0 =A0 } >>>> =A0 =A0 =A0else if (tmp->type =3D=3D record_mem) >>>> =A0 =A0 =A0 xfree (tmp->u.mem.val); >>>> =A0 =A0 =A0xfree (tmp); >>>> -- >>>> 1.5.4.3 >>>> >>>> >> >> Hi Michael, >> >> Could you please help me review this patch? > > Yes, I think it looks fine. =A0Please commit. Checked in. Thank you, Michael and Jilin. Hui > >> Following is my patch: >> >>> Cool. =A0Thanks for find it out. =A0:) >>> But this patch is not OK. =A0This record_reg should be record_end. >>> >>> I make a patch for it. >>> >>> Thanks, >>> Hui >>> >>> 2009-08-27 =A0Hui Zhu =A0 >>> >>> =A0 =A0 =A0 * record.c (record_list_release_next): Change the first >>> =A0 =A0 =A0 record_reg to record_end. >>> >> --- >> =A0record.c | =A0 =A02 +- >> =A01 file changed, 1 insertion(+), 1 deletion(-) >> >> --- a/record.c >> +++ b/record.c >> @@ -157,7 +157,7 @@ record_list_release_next (void) >> =A0 while (tmp) >> =A0 =A0 { >> =A0 =A0 =A0 rec =3D tmp->next; >> - =A0 =A0 =A0if (tmp->type =3D=3D record_reg) >> + =A0 =A0 =A0if (tmp->type =3D=3D record_end) >> =A0 =A0 =A0 =A0record_insn_num--; >> =A0 =A0 =A0 else if (tmp->type =3D=3D record_reg) >> =A0 =A0 =A0 =A0xfree (tmp->u.reg.val); > >