From 693a7261e5ebccaf0c74fde0ac48700ba3d52f17 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Sun, 3 Dec 2023 02:53:49 +0000 Subject: [PATCH] jq_fuzz_execute: fix memory leak Signed-off-by: David Korczynski --- tests/jq_fuzz_execute.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/jq_fuzz_execute.cpp b/tests/jq_fuzz_execute.cpp index 223d4fe36a..66a044f380 100644 --- a/tests/jq_fuzz_execute.cpp +++ b/tests/jq_fuzz_execute.cpp @@ -27,9 +27,11 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { jv_free(actual); } jv_free(next); + } else { + // Only free if input is invalid as otherwise jq_teardown + // frees it. + jv_free(input); } - - // Do not free "input" as this is handled by jq_teardown. } } jq_teardown(&jq);