From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6D978A0096 for ; Mon, 8 Apr 2019 12:49:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3E7184CE4; Mon, 8 Apr 2019 12:49:41 +0200 (CEST) Received: from netronome.com (unknown [217.38.71.146]) by dpdk.org (Postfix) with ESMTP id A5F2B4C8F; Mon, 8 Apr 2019 12:49:39 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id x38AndC3022948; Mon, 8 Apr 2019 11:49:39 +0100 Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id x38And1S022947; Mon, 8 Apr 2019 11:49:39 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 8 Apr 2019 11:49:39 +0100 Message-Id: <20190408104939.22902-1-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/nfp: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190408104939.jS8Hg6BoiCqIS2FB7UTZUkIBGDdyzD1mQBLtTHP0Xpk@z> Coverity issue: 32806 Fixes: ef28aa96e53b ("net/nfp: support multiprocess") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index 33baa989b..0b9db974e 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -690,12 +690,16 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc) lockfile = calloc(strlen(home_path) + strlen(lockname) + 1, sizeof(char)); + if (!lockfile) + return -ENOMEM; + strcat(lockfile, home_path); strcat(lockfile, "/.lock_nfp_secondary"); desc->secondary_lock = open(lockfile, O_RDWR | O_CREAT | O_NONBLOCK, 0666); if (desc->secondary_lock < 0) { RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n"); + free(lockfile); return desc->secondary_lock; } @@ -707,6 +711,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc) close(desc->secondary_lock); } + free(lockfile); return rc; } -- 2.17.1