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

Message ID 61277624bc2a0f718f97a80746ff63aca54053bf.1517834482.git.anatoly.burakov@intel.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Burakov, Anatoly Feb. 5, 2018, 1:03 p.m.
Add a teardown function that frees allocated resources.

Fixes: d0c9b58d7156 ("app/test: new reorder unit test")
Cc: sergio.gonzalez.monroy@intel.com
Cc: reshma.pattan@intel.com
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v4: fix Reshma Pattan's email address

 test/test/test_reorder.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/test/test/test_reorder.c b/test/test/test_reorder.c
index e834bac..65e4f38 100644
--- a/test/test/test_reorder.c
+++ b/test/test/test_reorder.c
@@ -331,9 +331,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),