From patchwork Thu Jun 21 06:15:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 166230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D5070B6F6E for ; Thu, 21 Jun 2012 16:24:17 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1340864659; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=0uJic1dk+dUO/tzz3Q4a L9QSbB0=; b=ZvaS4iAyj/wGYPMfHcP3vrIx2uVIgT0WgZrxer7CMTXdkMEuiGLn fthfwJ280Wz2BTKOnkKz8EYgcJlNl/I17yvhJnXmWOMMI3mDatLcCNv22hcWPcDJ w4eR8zl1moupbIQcx2AUa416Ub7z3nsTJcux3RWt2b/sHjRinEMq4O8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KkSovbENTObHwrKCHGd62Z+HRE7CbIfVHWhzslBnFMGOA1Ku1MHG01ABY65BUW YEYo8ELzzipfp3FenYkdD9b1ck7RX4bocSreAYCOqX+dsDe8HJ3ZGdIQKDRPPAPr lYe6KvmTYhHEJcBLcUyN1ZVGw0HlTpPBecneT8UFlw4b8=; Received: (qmail 10111 invoked by alias); 21 Jun 2012 06:24:12 -0000 Received: (qmail 10099 invoked by uid 22791); 21 Jun 2012 06:24:10 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, SPF_HELO_PASS 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; Thu, 21 Jun 2012 06:23:58 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5L6NvMY019909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jun 2012 02:23:57 -0400 Received: from zalov.cz (vpn1-6-154.ams2.redhat.com [10.36.6.154]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5L6Nshu014524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Jun 2012 02:23:56 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id q5L6Fc6l001203; Thu, 21 Jun 2012 08:15:38 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q5L6FcKG001202; Thu, 21 Jun 2012 08:15:38 +0200 Date: Thu, 21 Jun 2012 08:15:38 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva Subject: [PATCH] Fix accesses to freed up memory in var-tracking (PR debug/53706) Message-ID: <20120621061538.GO20264@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! During htab_delete (dropped_values), loc_exp_dep_pool allocated objects might be accessed, so it is better to free the pool afterwards. Bootstrapped/regtested on i686-linux, ok for trunk? 2012-06-21 Jakub Jelinek PR debug/53706 * var-tracking.c (vt_emit_notes): Free loc_exp_dep_pool only after htab_delete call. Jakub --- gcc/var-tracking.c.jj 2012-06-14 20:26:02.000000000 +0200 +++ gcc/var-tracking.c 2012-06-18 09:02:56.142742617 +0200 @@ -9127,9 +9127,9 @@ vt_emit_notes (void) if (MAY_HAVE_DEBUG_INSNS) { + htab_delete (dropped_values); free_alloc_pool (loc_exp_dep_pool); loc_exp_dep_pool = NULL; - htab_delete (dropped_values); } emit_notes = false;