3c51f3ab1e Merge bitcoin/bitcoin#23064: fuzz: Fix memory leak in system fuzz target (MarcoFalke)

Pull request description:

  Backports

ACKs for top commit:
  UdjinM6:
    utACK 3c51f3ab1e
  knst:
    utACK 3c51f3ab1e

Tree-SHA512: 1dc54750d0d897f272e65a25f25cd83ed21b9df02313a933286d0651c4e73c0c1c84aba643e81d33097746bde38a028c1c524f973c0f973c1555ede31f176cba
This commit is contained in:
pasta 2024-09-23 12:09:14 -05:00
commit a9a2d4adbe
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

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