From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10975 invoked by alias); 23 Apr 2009 22:40:29 -0000 Received: (qmail 10959 invoked by uid 22791); 23 Apr 2009 22:40:27 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Apr 2009 22:40:22 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3NMeL5U013850 for ; Thu, 23 Apr 2009 18:40:21 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3NMeK2P009502; Thu, 23 Apr 2009 18:40:20 -0400 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3NMeJ95013611; Thu, 23 Apr 2009 18:40:19 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n3NMeHeZ001587; Fri, 24 Apr 2009 00:40:18 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id n3NMeHHw001584; Fri, 24 Apr 2009 00:40:17 +0200 Date: Thu, 23 Apr 2009 22:40:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix double free on error while inserting the breakpoint Message-ID: <20090423224017.GA26409@host0.dyn.jankratochvil.net> References: <20081122214006.GA22076@host0.dyn.jankratochvil.net> <20090423203619.GA31736@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) 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-04/txt/msg00673.txt.bz2 On Thu, 23 Apr 2009 23:25:32 +0200, Tom Tromey wrote: > Looks good to me, please check it in. Checked-in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2009-04/msg00172.html 2009-04-23 Jan Kratochvil Fix double free on error inserting the breakpoint instruction. * breakpoint.c (create_breakpoints): Move the update_global_location_list call to ... (break_command_really): ... here together with the second local call both unified after all the cleanups. --- src/gdb/breakpoint.c 2009/03/31 16:44:17 1.390 +++ src/gdb/breakpoint.c 2009/04/23 22:38:24 1.391 @@ -5458,8 +5458,6 @@ cond_string, type, disposition, thread, task, ignore_count, ops, from_tty, enabled); } - - update_global_location_list (1); } /* Parse ARG which is assumed to be a SAL specification possibly @@ -5800,7 +5798,6 @@ b->ops = ops; b->enable_state = enabled ? bp_enabled : bp_disabled; - update_global_location_list (1); mention (b); } @@ -5812,6 +5809,9 @@ discard_cleanups (breakpoint_chain); /* But cleanup everything else. */ do_cleanups (old_chain); + + /* error call may happen here - have BREAKPOINT_CHAIN already discarded. */ + update_global_location_list (1); } /* Set a breakpoint.