mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
fuzz: Fix memory leak in system fuzz target
This commit is contained in:
parent
33e31f8df9
commit
aaaa37abba
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue