From 88d0e47880ec729dac682be5e4242e13ffd7dcd2 Mon Sep 17 00:00:00 2001 From: Shreyansh Jain Date: Wed, 24 Oct 2018 05:33:41 +0000 Subject: [PATCH] raw/skeleton: fix memory leak on test failure In skeleton_rawdev unit tests, a malloc'd memory was leaking in case the next sequential test fails. This fix moves the free of the malloc'd memory above the failing test. Coverity issue: 260402 Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases") Signed-off-by: Shreyansh Jain --- drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c index 3405b89849..359c9e296f 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c @@ -294,13 +294,14 @@ test_rawdev_attr_set_get(void) "Attribute (Test1) not set correctly (%" PRIu64 ")", ret_value); + free(dummy_value); + ret_value = 0; ret = rte_rawdev_get_attr(TEST_DEV_ID, "Test2", &ret_value); RTE_TEST_ASSERT_EQUAL(*((int *)(uintptr_t)ret_value), 200, "Attribute (Test2) not set correctly (%" PRIu64 ")", ret_value); - free(dummy_value); return TEST_SUCCESS; } -- 2.20.1