[dpdk-stable] patch 'test/hash: fix potential memory leak' has been queued to LTS release 16.11.8

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 27 12:17:47 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 16.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/29/18. So please
shout if anyone has objections.

Thanks.

Luca Boccassi

---
>From 825668ecf07f719abe8e8c389a175e38d37b4ad1 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch at intel.com>
Date: Tue, 17 Jul 2018 14:31:51 +0100
Subject: [PATCH] test/hash: fix potential memory leak

[ upstream commit a4492ab49ec3b829745c9060a1719354e0a572b7 ]

In the multiwriter test, if "found" array allocation failed,
the memory of "keys" array, which was successfully allocated
could not be freed, since by this time, tbl_multiwriter_test_params.keys
was not set to this array, which is the pointer freed when finishing
the test or when a failure happens.

To solve this, tbl_multiwriter_test_params.keys is set to the "keys"
address, just after allocating and filling the array.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
---
 app/test/test_hash_multiwriter.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/app/test/test_hash_multiwriter.c b/app/test/test_hash_multiwriter.c
index 951c3e743..0e9ac7162 100644
--- a/app/test/test_hash_multiwriter.c
+++ b/app/test/test_hash_multiwriter.c
@@ -181,16 +181,17 @@ test_hash_multiwriter(void)
 		goto err1;
 	}
 
+	for (i = 0; i < nb_entries; i++)
+		keys[i] = i;
+
+	tbl_multiwriter_test_params.keys = keys;
+
 	found = rte_zmalloc(NULL, sizeof(uint32_t) * nb_entries, 0);
 	if (found == NULL) {
 		printf("RTE_ZMALLOC failed\n");
 		goto err2;
 	}
 
-	for (i = 0; i < nb_entries; i++)
-		keys[i] = i;
-
-	tbl_multiwriter_test_params.keys = keys;
 	tbl_multiwriter_test_params.found = found;
 
 	rte_atomic64_init(&gcycles);
-- 
2.18.0



More information about the stable mailing list