From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7F52BAD95 for ; Mon, 23 Feb 2015 14:29:52 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 23 Feb 2015 05:25:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,631,1418112000"; d="scan'208";a="689416334" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 23 Feb 2015 05:29:24 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t1NDTNSa017635; Mon, 23 Feb 2015 13:29:23 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t1NDTMl9015829; Mon, 23 Feb 2015 13:29:22 GMT Received: (from jmcnam2x@localhost) by sivswdev02.ir.intel.com with id t1NDTMs6015825; Mon, 23 Feb 2015 13:29:22 GMT From: John McNamara To: dev@dpdk.org Date: Mon, 23 Feb 2015 13:29:16 +0000 Message-Id: <1424698156-15793-1-git-send-email-john.mcnamara@intel.com> X-Mailer: git-send-email 1.7.4.1 Cc: linville@redhat.com Subject: [dpdk-dev] [PATCH] af_packet: fix minor memory leak of kvlist in dev init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Feb 2015 13:29:53 -0000 Fix for Klockwork identified issue. Signed-off-by: John McNamara --- lib/librte_pmd_af_packet/rte_eth_af_packet.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c index 1ffe1cd..7ee3b31 100644 --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c @@ -803,7 +803,7 @@ rte_pmd_af_packet_devinit(const char *name, const char *params) { unsigned numa_node; int ret; - struct rte_kvargs *kvlist; + struct rte_kvargs *kvlist = NULL; int sockfd = -1; RTE_LOG(INFO, PMD, "Initializing pmd_af_packet for %s\n", name); @@ -823,16 +823,21 @@ rte_pmd_af_packet_devinit(const char *name, const char *params) ret = rte_kvargs_process(kvlist, ETH_AF_PACKET_IFACE_ARG, &open_packet_iface, &sockfd); if (ret < 0) - return -1; + goto out; } ret = rte_eth_from_packet(name, &sockfd, numa_node, kvlist); close(sockfd); /* no longer needed */ if (ret < 0) - return -1; + goto out; + rte_kvargs_free(kvlist); return 0; + +out: + rte_kvargs_free(kvlist); + return -1; } static struct rte_driver pmd_af_packet_drv = { -- 1.7.4.1