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 22D8E43197 for ; Wed, 18 Oct 2023 08:07:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 194BA40E5E; Wed, 18 Oct 2023 08:07:34 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 10F964027C; Wed, 18 Oct 2023 08:07:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697609251; x=1729145251; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5WG/TOV32kGVTv5SkMUhduDN2Eq3xj4ZtPO18/BkxW4=; b=HQEo9Pp2KB1noT7faseOCm2+IRT5nxizK7q17A4GYiJAsjgeJ+aq2z4U fo9MoVE4b9HD1IaTfYuLSFs+NfAEVRhGq+zUgzxOwp2b2riRVaJT/928j SAcmt5fEeZjJVNNZWfXCu7vtX4yaHKyhpWJvo68EGfE0WGFFvo+Zj7+xE i5v7N29oOOcm5t/rWzvCuHGxqso6ebootD9kvu3t9mx0jC/PC34LPc8/t M2G3IzFcVJ6M+Ck2Nnc91DsG4h5Tw4910gW6u3FCLVRohgEFa8ogmg1Oi XdPBBuE+kjfDqMFPzPP46EITCn9W6NdbxO0ocoWQpnqW1atd4DloomhL/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="385779596" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="385779596" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 23:07:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="1003643550" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="1003643550" Received: from dpdk-beileix-icelake.sh.intel.com ([10.67.116.231]) by fmsmga006.fm.intel.com with ESMTP; 17 Oct 2023 23:07:28 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com, yuying.zhang@intel.com Cc: dev@dpdk.org, Beilei Xing , stable@dpdk.org Subject: [PATCH v2] net/cpfl: fix memory leak Date: Wed, 18 Oct 2023 14:27:23 +0000 Message-Id: <20231018142723.835474-1-beilei.xing@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017110655.582873-1-beilei.xing@intel.com> References: <20231017110655.582873-1-beilei.xing@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Beilei Xing Fix resource leak reported in coverity scan. Coverity issue: 403265 Fixes: 2d823ecd671c ("net/cpfl: support device initialization") Fixes: 989465ac51ea ("net/cpfl: support probe again") Cc: stable@dpdk.org Signed-off-by: Beilei Xing --- v2 change: - add label finish for successful case. drivers/net/cpfl/cpfl_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index 890a027a1d..a94a0604f5 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1626,7 +1626,8 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap if (rte_kvargs_count(kvlist, CPFL_VPORT) > 1) { PMD_INIT_LOG(ERR, "devarg vport is duplicated."); - return -EINVAL; + ret = -EINVAL; + goto fail; } ret = rte_kvargs_process(kvlist, CPFL_REPRESENTOR, &parse_repr, cpfl_args); @@ -1635,7 +1636,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap goto fail; if (!first) - return 0; + goto finish; ret = rte_kvargs_process(kvlist, CPFL_VPORT, &parse_vport, cpfl_args); @@ -1663,6 +1664,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap cpfl_args->flow_parser[0] = '\0'; } #endif +finish: fail: rte_kvargs_free(kvlist); return ret; -- 2.34.1