From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A2426568F for ; Fri, 6 Mar 2015 08:56:54 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Mar 2015 23:56:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,351,1422950400"; d="scan'208";a="687822890" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2015 23:56:52 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t267upQv024935; Fri, 6 Mar 2015 15:56:51 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t267umdN001533; Fri, 6 Mar 2015 15:56:50 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t267umFQ001529; Fri, 6 Mar 2015 15:56:48 +0800 From: Michael Qiu To: dev@dpdk.org Date: Fri, 6 Mar 2015 15:56:47 +0800 Message-Id: <1425628607-1497-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] librte_pmd_fm10k: Set pointer to NULL after free 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: Fri, 06 Mar 2015 07:56:55 -0000 It could be a potential not safe issue. Signed-off-by: Michael Qiu --- lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c b/lib/librte_pmd_fm10k/fm10k_ethdev.c index 07ea1e7..30962d3 100644 --- a/lib/librte_pmd_fm10k/fm10k_ethdev.c +++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c @@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q) if (q) { PMD_INIT_LOG(DEBUG, "Freeing rx queue %p", q); rx_queue_clean(q); - if (q->sw_ring) + if (q->sw_ring) { rte_free(q->sw_ring); + q->sw_ring = NULL; + } rte_free(q); + q = NULL; } } @@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q) if (q) { PMD_INIT_LOG(DEBUG, "Freeing tx queue %p", q); tx_queue_clean(q); - if (q->rs_tracker.list) + if (q->rs_tracker.list) { rte_free(q->rs_tracker.list); - if (q->sw_ring) + q->rs_tracker.list = NULL; + } + if (q->sw_ring) { rte_free(q->sw_ring); + q->sw_ring = NULL; + } rte_free(q); + q = NULL; } } -- 1.9.3