From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id 01FE85B34 for ; Mon, 30 Jul 2018 18:22:12 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fkAsi-00009D-O3; Mon, 30 Jul 2018 16:18:48 +0000 From: Christian Ehrhardt To: Pablo de Lara Cc: dpdk stable Date: Mon, 30 Jul 2018 18:13:40 +0200 Message-Id: <20180730161342.16566-175-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730161342.16566-1-christian.ehrhardt@canonical.com> References: <20180730161342.16566-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'test/hash: fix potential memory leak' has been queued to stable release 18.05.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2018 16:22:12 -0000 Hi, FYI, your patch has been queued to stable release 18.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/01/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 1cd582bc78629d4956fc68f5165ab6548275c45b Mon Sep 17 00:00:00 2001 From: Pablo de Lara 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 --- test/test/test_hash_multiwriter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c index b9144a0da..a8ff811a5 100644 --- a/test/test/test_hash_multiwriter.c +++ b/test/test/test_hash_multiwriter.c @@ -153,16 +153,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.17.1