From 1431665cb02ab19a5fdf59882ee9594e22a63007 Mon Sep 17 00:00:00 2001 From: Devendra Singhi Date: Mon, 4 Apr 2022 14:03:55 +0530 Subject: [PATCH] sparse_fuzzer: Bug fix Resolved Memory Leak Test: ./sparse_fuzzer clusterfuzz-testcase-minimized-sparse_fuzzer-6050329726943232 Bug: 214604770 Change-Id: I8df4be935ff586efeebf7e32dccc52dbf82e5076 --- libsparse/sparse_fuzzer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsparse/sparse_fuzzer.cpp b/libsparse/sparse_fuzzer.cpp index 235d15dce..663c81243 100644 --- a/libsparse/sparse_fuzzer.cpp +++ b/libsparse/sparse_fuzzer.cpp @@ -23,5 +23,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (!file) { return 0; } - return sparse_file_callback(file, false, false, WriteCallback, nullptr); + int32_t result = sparse_file_callback(file, false, false, WriteCallback, nullptr); + sparse_file_destroy(file); + return result; }