[dpdk-dev] [PATCH v2] app/test/test_distributor.c: prevent memory leakages from the pool

Sarosh Arif sarosh.arif at emumba.com
Wed Apr 15 08:42:38 CEST 2020


v2:
remove double freeing of mbufs

Signed-off-by: Sarosh Arif <sarosh.arif at emumba.com>
---
 app/test/test_distributor.c | 9 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index ba1f81cf8..5e972bb2e 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -128,6 +128,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
 		printf("Line %d: Error, not all packets flushed. "
 				"Expected %u, got %u\n",
 				__LINE__, BURST, total_packet_count());
+		rte_mempool_put_bulk(p, (void *)bufs, BURST);
 		return -1;
 	}
 
@@ -153,6 +154,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
 			printf("Line %d: Error, not all packets flushed. "
 					"Expected %u, got %u\n",
 					__LINE__, BURST, total_packet_count());
+			rte_mempool_put_bulk(p, (void *)bufs, BURST);
 			return -1;
 		}
 
@@ -179,6 +181,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
 		printf("Line %d: Error, not all packets flushed. "
 				"Expected %u, got %u\n",
 				__LINE__, BURST, total_packet_count());
+		rte_mempool_put_bulk(p, (void *)bufs, BURST);
 		return -1;
 	}
 
@@ -233,6 +236,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
 	if (num_returned != BIG_BATCH) {
 		printf("line %d: Missing packets, expected %d\n",
 				__LINE__, num_returned);
+		rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
 		return -1;
 	}
 
@@ -247,6 +251,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p)
 
 		if (j == BIG_BATCH) {
 			printf("Error: could not find source packet #%u\n", i);
+			rte_mempool_put_bulk(p, (void *)many_bufs, BIG_BATCH);
 			return -1;
 		}
 	}

2.17.1



More information about the dev mailing list