[dpdk-stable] patch 'test/table: fix memory leak' has been queued to LTS release 16.11.5
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Wed Feb 7 17:47:03 CET 2018
Hi,
FYI, your patch has been queued to LTS release 16.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/09/18. So please
shout if anyone has objections.
Thanks.
Luca Boccassi
---
>From b0545730b56159064b6bba5a17c2d7d98452a646 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Tue, 6 Feb 2018 13:35:41 +0000
Subject: [PATCH] test/table: fix memory leak
[ upstream commit c1d30e443b624f8281b08ae7651feaf4b5ba1a09 ]
Always deallocate allocated resources after the test is done.
Fixes: 5205954791cb ("app/test: packet framework unit tests")
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
app/test/test_table.c | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/app/test/test_table.c b/app/test/test_table.c
index 1faa0a6d8..31eac117c 100644
--- a/app/test/test_table.c
+++ b/app/test/test_table.c
@@ -82,6 +82,14 @@ uint64_t pipeline_test_hash(void *key,
return signature;
}
+static void
+app_free_resources(void) {
+ int i;
+ for (i = 0; i < N_PORTS; i++)
+ rte_ring_free(rings_rx[i]);
+ rte_mempool_free(pool);
+}
+
static void
app_init_mbuf_pools(void)
{
@@ -141,18 +149,20 @@ app_init_rings(void)
static int
test_table(void)
{
- int status, failures;
+ int status, ret;
unsigned i;
- failures = 0;
+ ret = TEST_SUCCESS;
app_init_rings();
app_init_mbuf_pools();
printf("\n\n\n\n************Pipeline tests************\n");
- if (test_table_pipeline() < 0)
- return -1;
+ if (test_table_pipeline() < 0) {
+ ret = TEST_FAILED;
+ goto end;
+ }
printf("\n\n\n\n************Port tests************\n");
for (i = 0; i < n_port_tests; i++) {
@@ -160,8 +170,8 @@ test_table(void)
if (status < 0) {
printf("\nPort test number %d failed (%d).\n", i,
status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
@@ -171,8 +181,8 @@ test_table(void)
if (status < 0) {
printf("\nTable test number %d failed (%d).\n", i,
status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
@@ -182,21 +192,23 @@ test_table(void)
if (status < 0) {
printf("\nCombined table test number %d failed with "
"reason number %d.\n", i, status);
- failures++;
- return -1;
+ ret = TEST_FAILED;
+ goto end;
}
}
- if (failures)
- return -1;
-
#ifdef RTE_LIBRTE_ACL
printf("\n\n\n\n************ACL tests************\n");
- if (test_table_acl() < 0)
- return -1;
+ if (test_table_acl() < 0) {
+ ret = TEST_FAILED;
+ goto end;
+ }
#endif
- return 0;
+end:
+ app_free_resources();
+
+ return ret;
}
REGISTER_TEST_COMMAND(table_autotest, test_table);
--
2.14.2
More information about the stable
mailing list