From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id 623A120F for ; Tue, 4 Aug 2015 18:12:14 +0200 (CEST) Received: by pawu10 with SMTP id u10so11964551paw.1 for ; Tue, 04 Aug 2015 09:12:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=OP8Lck1q+P4namnMF/XQoR5U46k+TYwDDPTTNiAISsw=; b=RsezBmrSHYUl02uzE77suZAPBJtAXvEHahErI9b7IRRQKx/BShyUIzKUpWVxuRfamA N6YJN7NwUHR57VeIIN+siQpcHcS6M4/5iwVNb5PyVuX9/FPle/ePuHdjXhT6ovyIkF7f TxlcTcuh0lRZUSOLx61S0AvT1XQXrOjWKVW9bzTKqdOeku6VZ3xmbrCgUydpNmEV3WGY pl72V3DpN2/bm8uM0NchSbx6K9g2GlGc5obVccPwGRPmisqK9YLZhT8H7ZLKWv/hO5bG B+9bVtXyTdRr28YKcef2LjMCYr10JnxU6nYtv0aqwpicvPF5I8Ph9tmE1ISzqBB6Fg0a j9XQ== X-Gm-Message-State: ALoCoQntGZPwVSwwjrPGYB0Mqp50nE77VESqqMC5Ag1HSZidQ40KfPoR35+zdLgEPttWFNE64UqP X-Received: by 10.68.65.99 with SMTP id w3mr9461811pbs.146.1438704733652; Tue, 04 Aug 2015 09:12:13 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id ra10sm1945921pab.19.2015.08.04.09.12.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 09:12:13 -0700 (PDT) Date: Tue, 4 Aug 2015 09:12:23 -0700 From: Stephen Hemminger To: chixiaobo Message-ID: <20150804091223.4e7142c6@urahara> In-Reply-To: <1438679058-18324-1-git-send-email-xiaobo.chi@nokia.com> References: <1438679058-18324-1-git-send-email-xiaobo.chi@nokia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] array malloced by backtrace_symbols() should be freed by the caller X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 16:12:14 -0000 On Tue, 4 Aug 2015 17:04:18 +0800 chixiaobo wrote: > diff --git a/lib/librte_eal/linuxapp/eal/eal_debug.c b/lib/librte_eal/linuxapp/eal/eal_debug.c > index 44fc4f3..ceca2e8 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_debug.c > +++ b/lib/librte_eal/linuxapp/eal/eal_debug.c > @@ -58,6 +58,9 @@ void rte_dump_stack(void) > "%d: [%s]\n", size, symb[size - 1]); > size --; > } > + /* This array is malloced by backtrace_symbols(), and must be freed by the caller */ > + if( symb ) > + free( (void *)symb ); I agree that free() should probably be done, but am a little worried that it just make things break. Since lots of times when this code is called the malloc pool is in broken state because the whole reason for calling backtrace is to handle panic situation. Please use the standard white space style, and do not add a cast to void * where none is required in C. On a related note, I found that backtrace_symbols was rather poor at decoding and finding many symbols. The unwind library does a better job.