Free the allocated buffer before returning.

Fixes: a40a1f8231b4 ("app: various tests update")
Cc: [email protected]

Signed-off-by: Ruifeng Wang <[email protected]>
Reviewed-by: Feifei Wang <[email protected]>
---
 app/test/test_malloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index de40e50611..f144b89d88 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -937,6 +937,7 @@ test_alloc_single_socket(int32_t socket)
        if (mem == NULL)
                return -1;
        if (addr_to_socket(mem) != desired_socket) {
+               rte_free(mem);
                return -1;
        }
        rte_free(mem);
-- 
2.25.1

Reply via email to