From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10111 invoked by alias); 22 Apr 2009 23:11:42 -0000 Received: (qmail 10101 invoked by uid 22791); 22 Apr 2009 23:11:42 -0000 X-SWARE-Spam-Status: No, hits=-2.3 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; Wed, 22 Apr 2009 23:11:35 +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 n3MNBTJ3007657 for ; Wed, 22 Apr 2009 19:11:29 -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 n3MNBSv2011180; Wed, 22 Apr 2009 19:11:28 -0400 Received: from opsy.redhat.com (vpn-14-158.rdu.redhat.com [10.11.14.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3MNBRkf004963; Wed, 22 Apr 2009 19:11:27 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id A331037829A; Wed, 22 Apr 2009 17:11:26 -0600 (MDT) To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix double free on error while inserting the breakpoint References: <20081122214006.GA22076@host0.dyn.jankratochvil.net> From: Tom Tromey Reply-To: tromey@redhat.com Date: Wed, 22 Apr 2009 23:11:00 -0000 In-Reply-To: <20081122214006.GA22076@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Sat\, 22 Nov 2008 22\:40\:06 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00622.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> x86 requires to build GDB with -lmcheck to make the crash reproducible. FWIW, I reproduced this with valgrind. Jan> 2008-11-22 Jan Kratochvil Jan> Fix double free on error inserting the breakpoint instruction. Jan> * breakpoint.c (create_breakpoints): Move the Jan> update_global_location_list call to ... Jan> (break_command_really): ... here together with the second local call Jan> both unified after all the cleanups. I like this but I am unsure whether it is ok to move the call to update_global_location_list past the call to mention. Jan> + /* Have already BREAKPOINT_CHAIN discarded as we may get an exception while Jan> + inserting the breakpoints which would double-free the resources both by Jan> + BREAKPOINT_CHAIN now and during DELETE_BREAKPOINT in the future. */ Jan> + update_global_location_list (1); I found this comment pretty hard to follow. I think the code would be pretty clear without it. Tom