[v2,3/3] test/hash: free allocated memory

Message ID 20190628045254.17614-3-honnappa.nagarahalli@arm.com
State New
Headers show
Series
  • [v2,1/3] test/hash: reset global variable to discard old data
Related show

Commit Message

Honnappa Nagarahalli June 28, 2019, 4:52 a.m.
Free allocated memory.

Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>

---
 app/test/test_hash_readwrite_lf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

David Marchand June 28, 2019, 8:38 a.m. | #1
On Fri, Jun 28, 2019 at 6:53 AM Honnappa Nagarahalli <
honnappa.nagarahalli@arm.com> wrote:

> Free allocated memory.

>

> Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket")

> Cc: stable@dpdk.org

>

> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>

> ---

>  app/test/test_hash_readwrite_lf.c | 9 ++++++++-

>  1 file changed, 8 insertions(+), 1 deletion(-)

>

> diff --git a/app/test/test_hash_readwrite_lf.c

> b/app/test/test_hash_readwrite_lf.c

> index 12522e265..9b054dec0 100644

> --- a/app/test/test_hash_readwrite_lf.c

> +++ b/app/test/test_hash_readwrite_lf.c

>

>

[snip]

@@ -653,6 +656,8 @@ test_rwc_reader(__attribute__((unused)) void *arg)
>         cycles = rte_rdtsc_precise() - begin;

>         rte_atomic64_add(&gread_cycles, cycles);

>         rte_atomic64_add(&greads, read_cnt*loop_cnt);

> +

> +       rte_free(pos);

>         return 0;

>  }

>


In this function, there are three other places returning -1 without freeing
pos.


-- 
David Marchand

Patch

diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c
index 12522e265..9b054dec0 100644
--- a/app/test/test_hash_readwrite_lf.c
+++ b/app/test/test_hash_readwrite_lf.c
@@ -537,6 +537,7 @@  generate_keys(void)
 	       tbl_rwc_test_param.count_keys_ks_extbkt);
 
 	rte_free(found);
+	rte_free(scanned_bkts);
 	rte_hash_free(tbl_rwc_test_param.h);
 	return 0;
 
@@ -547,9 +548,11 @@  generate_keys(void)
 	rte_free(keys_absent);
 	rte_free(found);
 	rte_free(tbl_rwc_test_param.keys_shift_path);
+	rte_free(keys_non_shift_path);
 	rte_free(keys_ext_bkt);
 	rte_free(keys_ks_extbkt);
 	rte_free(scanned_bkts);
+	rte_hash_free(tbl_rwc_test_param.h);
 	return -1;
 }
 
@@ -653,6 +656,8 @@  test_rwc_reader(__attribute__((unused)) void *arg)
 	cycles = rte_rdtsc_precise() - begin;
 	rte_atomic64_add(&gread_cycles, cycles);
 	rte_atomic64_add(&greads, read_cnt*loop_cnt);
+
+	rte_free(pos);
 	return 0;
 }
 
@@ -1431,7 +1436,9 @@  test_hash_readwrite_lf_main(void)
 	rte_free(tbl_rwc_test_param.keys_ks);
 	rte_free(tbl_rwc_test_param.keys_absent);
 	rte_free(tbl_rwc_test_param.keys_shift_path);
-	rte_free(scanned_bkts);
+	rte_free(tbl_rwc_test_param.keys_non_shift_path);
+	rte_free(tbl_rwc_test_param.keys_ext_bkt);
+	rte_free(tbl_rwc_test_param.keys_ks_extbkt);
 	return 0;
 }