From aaaa37abbab69fe1fdc2d332bbaf6ecce0c5cc00 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 22 Sep 2021 14:39:07 +0200 Subject: [PATCH] fuzz: Fix memory leak in system fuzz target --- src/test/fuzz/system.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/fuzz/system.cpp b/src/test/fuzz/system.cpp index 00403c1a323..dc3f9c8b8f9 100644 --- a/src/test/fuzz/system.cpp +++ b/src/test/fuzz/system.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -12,6 +13,11 @@ #include namespace { +void initialize_system() +{ + static const auto testing_setup = MakeNoLogFileContext<>(); +} + std::string GetArgumentName(const std::string& name) { size_t idx = name.find('='); @@ -20,9 +26,8 @@ std::string GetArgumentName(const std::string& name) } return name.substr(0, idx); } -} // namespace -FUZZ_TARGET(system) +FUZZ_TARGET_INIT(system, initialize_system) { FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); ArgsManager args_manager{}; @@ -114,3 +119,4 @@ FUZZ_TARGET(system) (void)HelpRequested(args_manager); } +} // namespace