From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v8] linuxapp, eal: Fix the memory leak issue of logid Date: Mon, 22 Oct 2018 10:00:59 +0200 Message-ID: <30207781.zVJTsycACh@xps> References: <1536125954-46632-1-git-send-email-ziye.yang@intel.com> <1536715910-38320-1-git-send-email-ziye.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, konstantin.ananyev@intel.com, Ziye Yang To: Ziye Yang Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 421B54C99 for ; Mon, 22 Oct 2018 10:01:01 +0200 (CEST) In-Reply-To: <1536715910-38320-1-git-send-email-ziye.yang@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" 12/09/2018 03:31, Ziye Yang: > From: Ziye Yang > > This patch is used to fix the memory leak issue of logid. > We use the ASAN test in SPDK when intergrating DPDK and > find this memory leak issue. > > Signed-off-by: Ziye Yang > --- > - logid = strrchr(argv[0], '/'); > - logid = strdup(logid ? logid + 1: argv[0]); > - > + p = strrchr(argv[0], '/'); > + snprintf(logid, sizeof(logid), "%s", (p ? p + 1 : argv[0])); Shouldn't it be strlcpy instead of snprintf?