mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
fuzz: Fix memory leak in system fuzz target
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
|
#include <test/util/setup_common.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -12,6 +13,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
void initialize_system()
|
||||||
|
{
|
||||||
|
static const auto testing_setup = MakeNoLogFileContext<>();
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetArgumentName(const std::string& name)
|
std::string GetArgumentName(const std::string& name)
|
||||||
{
|
{
|
||||||
size_t idx = name.find('=');
|
size_t idx = name.find('=');
|
||||||
@@ -20,9 +26,8 @@ std::string GetArgumentName(const std::string& name)
|
|||||||
}
|
}
|
||||||
return name.substr(0, idx);
|
return name.substr(0, idx);
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
FUZZ_TARGET(system)
|
FUZZ_TARGET_INIT(system, initialize_system)
|
||||||
{
|
{
|
||||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||||
ArgsManager args_manager{};
|
ArgsManager args_manager{};
|
||||||
@@ -114,3 +119,4 @@ FUZZ_TARGET(system)
|
|||||||
|
|
||||||
(void)HelpRequested(args_manager);
|
(void)HelpRequested(args_manager);
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user