From patchwork Thu Apr 28 00:33:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 93131 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 46C92B6F07 for ; Thu, 28 Apr 2011 10:34:19 +1000 (EST) Received: (qmail 3844 invoked by alias); 28 Apr 2011 00:34:17 -0000 Received: (qmail 3784 invoked by uid 22791); 28 Apr 2011 00:34:16 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Apr 2011 00:34:02 +0000 Received: from hpaq11.eem.corp.google.com (hpaq11.eem.corp.google.com [172.25.149.11]) by smtp-out.google.com with ESMTP id p3S0Y004032444 for ; Wed, 27 Apr 2011 17:34:00 -0700 Received: from yib12 (yib12.prod.google.com [10.243.65.76]) by hpaq11.eem.corp.google.com with ESMTP id p3S0XcX3016609 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 27 Apr 2011 17:33:59 -0700 Received: by yib12 with SMTP id 12so1025348yib.29 for ; Wed, 27 Apr 2011 17:33:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.28.10 with SMTP id f10mr2431176ybj.184.1303950838959; Wed, 27 Apr 2011 17:33:58 -0700 (PDT) Received: by 10.151.41.13 with HTTP; Wed, 27 Apr 2011 17:33:58 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Apr 2011 20:33:58 -0400 Message-ID: Subject: Re: trial fix to null pointer free From: Diego Novillo To: Xinliang David Li Cc: GCC Patches , Jan Hubicka X-System-Of-Record: true 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 On Wed, Apr 27, 2011 at 19:23, Xinliang David Li wrote: > This can happen when the module does not have function bodies. > > > Ok after testing? > > Thanks, > > David > > > 2011-04-27  Xinliang David Li   > >        * value-prof.c (del_node_map): Do not free >        null pointer. > remove the assignment 'cgraph_node_map = NULL' since VEC_free already clears it. Diego. Index: value-prof.c =================================================================== --- value-prof.c (revision 172977) +++ value-prof.c (working copy) @@ -1086,8 +1086,9 @@ init_node_map (void) void del_node_map (void) { - VEC_free (cgraph_node_ptr, heap, cgraph_node_map); - cgraph_node_map = NULL; + if (cgraph_node_map) + VEC_free (cgraph_node_ptr, heap, cgraph_node_map); + cgraph_node_map = NULL; } This is not necessary. Freeing a NULL VEC has no effect. You could