[dpdk-dev] [PATCH 2/6] test: fix memory leak in reorder autotest

Anatoly Burakov anatoly.burakov at intel.com
Fri Dec 22 11:12:06 CET 2017


Add a teardown function that frees allocated resources.

Fixes: d0c9b58d7156 ("app/test: new reorder unit test")
Cc: sergio.gonzalez.monroy at intel.com
Cc: reshma.pattan at intek.com
Cc: stable at dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 test/test/test_reorder.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/test/test_reorder.c b/test/test/test_reorder.c
index 4ec22ac..429f6eb4 100644
--- a/test/test/test_reorder.c
+++ b/test/test/test_reorder.c
@@ -360,9 +360,20 @@ test_setup(void)
 	return 0;
 }
 
+static void
+test_teardown(void)
+{
+	rte_reorder_free(test_params->b);
+	test_params->b = NULL;
+	rte_mempool_free(test_params->p);
+	test_params->p = NULL;
+}
+
+
 static struct unit_test_suite reorder_test_suite  = {
 
 	.setup = test_setup,
+	.teardown = test_teardown,
 	.suite_name = "Reorder Unit Test Suite",
 	.unit_test_cases = {
 		TEST_CASE(test_reorder_create),
-- 
2.7.4


More information about the dev mailing list