From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] eal: fix resource leak Date: Fri, 06 Oct 2017 00:33:23 +0200 Message-ID: <4160089.UZJ91qkqPz@xps> References: <20170919133432.6437-1-danielx.t.mrzyglod@intel.com> <20170922144820.16590-1-danielx.t.mrzyglod@intel.com> <27670627-01f0-7fff-0aa8-c9a9d2b89e3d@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Ferruh Yigit , Daniel Mrzyglod Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 8F1C61B1C4 for ; Fri, 6 Oct 2017 00:33:25 +0200 (CEST) In-Reply-To: <27670627-01f0-7fff-0aa8-c9a9d2b89e3d@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 04/10/2017 21:24, Ferruh Yigit: > On 9/22/2017 3:48 PM, Daniel Mrzyglod wrote: > > Memory allocated in strdup is not free. > > > > Coverity issue: 143257 > > Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id") > > Cc: thomas@monjalon.net > > > > Signed-off-by: Daniel Mrzyglod > > --- > This works but this variable is a nuance and adding free() for this it > into main eal features fail path looks like noise. > > Initially, do we need to strdup this variable at all? > What will happen if logid fed into rte_eal_log_init() without strdup? > Since it is const char *, I guess the string is just for read and > content won't be changed so it should be OK I guess. > > If above is not right, what about creating a static variable and use it > instead of dynamically allocating the logid, what do you think? Good proposal Ferruh. It seems strdup is not needed as it is basically argv[0].