From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 36ED791; Tue, 13 Nov 2018 12:46:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 03:46:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,499,1534834800"; d="scan'208";a="91661717" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga008.jf.intel.com with ESMTP; 13 Nov 2018 03:46:03 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wADBk2Q1003719; Tue, 13 Nov 2018 11:46:02 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id wADBjcau014593; Tue, 13 Nov 2018 11:45:38 GMT Received: (from hvemulax@localhost) by wgcvswdev001.ir.intel.com with œ id wADBjcl1014588; Tue, 13 Nov 2018 11:45:38 GMT From: Hari Kumar Vemula To: dev@dpdk.org Cc: reshma.pattan@intel.com, byron.marohn@intel.com, pablo.de.lara.guarch@intel.com, Hari Kumar Vemula , stable@dpdk.org Date: Tue, 13 Nov 2018 11:45:33 +0000 Message-Id: <1542109533-14283-1-git-send-email-hari.kumarx.vemula@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] lib: fix to free trail queue entry after use 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: , X-List-Received-Date: Tue, 13 Nov 2018 11:46:07 -0000 In rte_efd_create() allocated memory for trail queue entry but not freed. Added freeing the trail queue entry. Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library") Cc: stable@dpdk.org Signed-off-by: Hari Kumar Vemula --- lib/librte_efd/rte_efd.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c index a780e2fe8..f8c6c447f 100644 --- a/lib/librte_efd/rte_efd.c +++ b/lib/librte_efd/rte_efd.c @@ -739,17 +739,38 @@ void rte_efd_free(struct rte_efd_table *table) { uint8_t socket_id; + struct rte_efd_list *efd_list = NULL; + struct rte_tailq_entry *te; if (table == NULL) return; + efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list); + for (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES; socket_id++) rte_free(table->chunks[socket_id]); + rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + + /* find our tailq entry */ + TAILQ_FOREACH(te, efd_list, next) { + if (te->data == (void *) table) + break; + } + + if (te == NULL) { + rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + return; + } + + TAILQ_REMOVE(efd_list, te, next); + rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_ring_free(table->free_slots); rte_free(table->offline_chunks); rte_free(table->keys); rte_free(table); + rte_free(te); } /** -- 2.13.6