From 9fc985ae9dd3f1a9c815662e3aca0c798f831585 Mon Sep 17 00:00:00 2001 From: Michael Qiu Date: Fri, 6 Mar 2015 15:56:47 +0800 Subject: [PATCH] fm10k: set pointer to NULL after free It could be a potential not safe issue. Signed-off-by: Michael Qiu Acked-by: Jing Chen --- 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 62c4a397c8..0c7a80c7f8 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; } } -- 2.20.1