From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89862A09E4; Thu, 22 Apr 2021 11:36:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0ADB54068E; Thu, 22 Apr 2021 11:36:46 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id C7A1D4003D for ; Thu, 22 Apr 2021 11:36:44 +0200 (CEST) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FQsgt1vxczBsF4 for ; Thu, 22 Apr 2021 17:34:18 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 17:36:37 +0800 To: "Dumitrescu, Cristian" , "dev@dpdk.org" CC: "Yigit, Ferruh" References: <1619073510-58316-1-git-send-email-humin29@huawei.com> From: "Min Hu (Connor)" Message-ID: <4ba72d50-b05f-ddc1-46e6-83426c972bcf@huawei.com> Date: Thu, 22 Apr 2021 17:36:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] pipeline: fix deallocate null pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" ÔÚ 2021/4/22 16:36, Dumitrescu, Cristian дµÀ: > > >> -----Original Message----- >> From: Min Hu (Connor) >> Sent: Thursday, April 22, 2021 7:39 AM >> To: dev@dpdk.org >> Cc: Yigit, Ferruh ; Dumitrescu, Cristian >> >> Subject: [PATCH] pipeline: fix deallocate null pointer >> >> From: HongBo Zheng >> >> Fix deallocate null pointer in instruction_config, while >> pointer 'data' or 'instr' may be null. >> >> Fixes: a1711f948dbf ("pipeline: add SWX Rx and extract instructions") >> Cc: stable@dpdk.org >> >> Signed-off-by: HongBo Zheng >> Signed-off-by: Min Hu (Connor) >> --- >> lib/librte_pipeline/rte_swx_pipeline.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/lib/librte_pipeline/rte_swx_pipeline.c >> b/lib/librte_pipeline/rte_swx_pipeline.c >> index 4455d91..6084635 100644 >> --- a/lib/librte_pipeline/rte_swx_pipeline.c >> +++ b/lib/librte_pipeline/rte_swx_pipeline.c >> @@ -8015,8 +8015,10 @@ instruction_config(struct rte_swx_pipeline *p, >> return 0; >> >> error: >> - free(data); >> - free(instr); >> + if (data) >> + free(data); >> + if (instr) >> + free(instr); >> return err; >> } >> >> -- >> 2.7.4 > > Hi, > > NACK. > > Thanks for the patch, but the tests for data and instr being non-NULL before calling free are not required, because: > 1. Both data and instr are initialized to NULL. > 2. free(NULL) is supported. > Agreed, thanks Cristian, this patch can be abandoned. > Regards, > Cristian > . >