aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2023-07-03 12:18:31 +0300
committerGitHub <noreply@github.com>2023-07-03 10:18:31 +0100
commitedb0d3d46d76df6c54c174f026c8a6a21b833ebf (patch)
tree06e1c1ce4746446b0bf99b08e395a15b387db401
parentfed73374d7d2843f4197e76547349e54f180d312 (diff)
downloadgoogle-benchmark-edb0d3d46d76df6c54c174f026c8a6a21b833ebf.tar.gz
Suppress intentional potential memory leak as detected by clang static analysis (#1618)
https://github.com/google/benchmark/issues/1513 Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
-rw-r--r--include/benchmark/benchmark.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h
index 558aca8..1444ec6 100644
--- a/include/benchmark/benchmark.h
+++ b/include/benchmark/benchmark.h
@@ -1362,6 +1362,8 @@ class LambdaBenchmark : public Benchmark {
inline internal::Benchmark* RegisterBenchmark(const std::string& name,
internal::Function* fn) {
+ // FIXME: this should be a `std::make_unique<>()` but we don't have C++14.
+ // codechecker_intentional [cplusplus.NewDeleteLeaks]
return internal::RegisterBenchmarkInternal(
::new internal::FunctionBenchmark(name, fn));
}
@@ -1371,6 +1373,8 @@ template <class Lambda>
internal::Benchmark* RegisterBenchmark(const std::string& name, Lambda&& fn) {
using BenchType =
internal::LambdaBenchmark<typename std::decay<Lambda>::type>;
+ // FIXME: this should be a `std::make_unique<>()` but we don't have C++14.
+ // codechecker_intentional [cplusplus.NewDeleteLeaks]
return internal::RegisterBenchmarkInternal(
::new BenchType(name, std::forward<Lambda>(fn)));
}