From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8517A9A99 for ; Wed, 25 Feb 2015 13:53:50 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 25 Feb 2015 04:53:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,644,1418112000"; d="scan'208";a="656979090" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga001.jf.intel.com with SMTP; 25 Feb 2015 04:53:47 -0800 Received: by Sent (sSMTP sendmail emulation); Wed, 25 Feb 2015 13:54:43 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Wed, 25 Feb 2015 13:41:25 +0100 Message-Id: <1424868086-4232-4-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424868086-4232-1-git-send-email-pawelx.wodkowski@intel.com> References: <1424700600-1765-1-git-send-email-pawelx.wodkowski@intel.com> <1424868086-4232-1-git-send-email-pawelx.wodkowski@intel.com> Subject: [dpdk-dev] [PATCH v2 3/4] pmd ring: fix possible memory leak during devinit 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: Wed, 25 Feb 2015 12:53:51 -0000 Free kvlist on function exit to avoid memory leak. Signed-off-by: Pawel Wodkowski --- lib/librte_pmd_ring/rte_eth_ring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c index a5dc71e..f049bb3 100644 --- a/lib/librte_pmd_ring/rte_eth_ring.c +++ b/lib/librte_pmd_ring/rte_eth_ring.c @@ -527,7 +527,7 @@ out: static int rte_pmd_ring_devinit(const char *name, const char *params) { - struct rte_kvargs *kvlist; + struct rte_kvargs *kvlist = NULL; int ret = 0; struct node_action_list *info = NULL; @@ -548,7 +548,7 @@ rte_pmd_ring_devinit(const char *name, const char *params) info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) + (sizeof(struct node_action_pair) * ret), 0); if (!info) - goto out; + goto out_free; info->total = ret; info->list = (struct node_action_pair*)(info + 1); @@ -567,8 +567,8 @@ rte_pmd_ring_devinit(const char *name, const char *params) } out_free: + rte_kvargs_free(kvlist); rte_free(info); -out: return ret; } -- 1.9.1