fuzz: Fix memory leak in system fuzz target

This commit is contained in:
MarcoFalke 2021-09-22 14:39:07 +02:00
parent 33e31f8df9
commit aaaa37abba
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -5,6 +5,7 @@
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <test/util/setup_common.h>
#include <util/system.h>
#include <cstdint>
@ -12,6 +13,11 @@
#include <vector>
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