app/pdump: free mempool at cleanup resources

Message ID 1645704898-52464-1-git-send-email-laitianli@tom.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series app/pdump: free mempool at cleanup resources |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues

Commit Message

Tianli Lai Feb. 24, 2022, 12:14 p.m. UTC
  the mempool should be free when cleanup resources.

Signed-off-by: Tianli Lai <laitianli@tom.com>
---
 app/pdump/main.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Stephen Hemminger Feb. 24, 2022, 4:01 p.m. UTC | #1
On Thu, 24 Feb 2022 20:14:58 +0800
Tianli Lai <laitianli@tom.com> wrote:

> +		if (pt->mp) {
> +			rte_mempool_free(pt->mp);
> +			pt->mp = NULL;

Check for null is unnecessary here, rte_mempool_free(NULL) is nop.
  

Patch

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 46f9d25..8101078 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -510,6 +510,10 @@  struct parse_val {
 			rte_ring_free(pt->rx_ring);
 		if (pt->tx_ring)
 			rte_ring_free(pt->tx_ring);
+		if (pt->mp) {
+			rte_mempool_free(pt->mp);
+			pt->mp = NULL;
+		}
 	}
 }