From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10884 invoked by alias); 22 Sep 2010 16:15:22 -0000 Received: (qmail 10855 invoked by uid 22791); 22 Sep 2010 16:15:21 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 16:15:15 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8MGF63W018145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 22 Sep 2010 12:15:07 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8MGF6I2019811; Wed, 22 Sep 2010 12:15:06 -0400 Received: from [10.11.9.144] (vpn-9-144.rdu.redhat.com [10.11.9.144]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o8MGF5D6007019; Wed, 22 Sep 2010 12:15:05 -0400 Message-ID: <4C9A2B89.4080601@redhat.com> Date: Wed, 22 Sep 2010 18:12:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: Doug Evans CC: gdb-patches@sourceware.org Subject: Re: [patch] PR 12028 "GDB crashes on a double free during overload resolution" References: <4C937E2D.80500@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------070700010200050303010906" 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: 2010-09/txt/msg00373.txt.bz2 This is a multi-part message in MIME format. --------------070700010200050303010906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 888 On 09/18/2010 12:03 PM, Doug Evans wrote: > On Fri, Sep 17, 2010 at 7:41 AM, sami wagiaalla wrote: >> old_cleanups was being set twice making the later call to discard_cleanups >> ignore the first 'make_cleanup' request. >> >> The patch is proposed for both head and the 7.2 branch. >> >> This has been regression tested on x8664 with gcc-4.4.4-10.fc13 >> >> Sami >> > > Hi. This patch is ok. > Thanks for the review. > Looking at the function though, is this a memory leak? > i.e. you want to do_cleanups here, not discard them (right?). > > else > { > *oload_syms = new_oload_syms; > *oload_champ = new_oload_champ; > *oload_champ_bv = new_oload_champ_bv; > discard_cleanups (old_cleanups); > return 0; > } I agree. I have attached a patch which has been regression tested on x8664 with gcc-4.4.4-10.fc13 Sami --------------070700010200050303010906 Content-Type: text/x-patch; name="oload_memory_leak.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="oload_memory_leak.patch" Content-length: 621 Fix find_oload_champ_namespace_loop memory leak. 2010-09-22 Sami Wagiaalla * valops.c (find_oload_champ_namespace_loop): replace incorrect discard_cleanups do_cleanups. diff --git a/gdb/valops.c b/gdb/valops.c index bbbf66e..13c83ff 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2760,7 +2760,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, *oload_syms = new_oload_syms; *oload_champ = new_oload_champ; *oload_champ_bv = new_oload_champ_bv; - discard_cleanups (old_cleanups); + do_cleanups (old_cleanups); return 0; } } --------------070700010200050303010906--