Skip to content

Commit aaaa37a

Browse files
author
MarcoFalke
committed
fuzz: Fix memory leak in system fuzz target
1 parent 33e31f8 commit aaaa37a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/test/fuzz/system.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
#include <test/fuzz/FuzzedDataProvider.h>
66
#include <test/fuzz/fuzz.h>
77
#include <test/fuzz/util.h>
8+
#include <test/util/setup_common.h>
89
#include <util/system.h>
910

1011
#include <cstdint>
1112
#include <string>
1213
#include <vector>
1314

1415
namespace {
16+
void initialize_system()
17+
{
18+
static const auto testing_setup = MakeNoLogFileContext<>();
19+
}
20+
1521
std::string GetArgumentName(const std::string& name)
1622
{
1723
size_t idx = name.find('=');
@@ -20,9 +26,8 @@ std::string GetArgumentName(const std::string& name)
2026
}
2127
return name.substr(0, idx);
2228
}
23-
} // namespace
2429

25-
FUZZ_TARGET(system)
30+
FUZZ_TARGET_INIT(system, initialize_system)
2631
{
2732
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
2833
ArgsManager args_manager{};
@@ -114,3 +119,4 @@ FUZZ_TARGET(system)
114119

115120
(void)HelpRequested(args_manager);
116121
}
122+
} // namespace

0 commit comments

Comments
 (0)