Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: net/base/fuzzer_test_support.cc

Issue 1941933002: net: Prevent fuzzers from leaking on each iteration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/fuzzer_test_support.cc
diff --git a/net/base/fuzzer_test_support.cc b/net/base/fuzzer_test_support.cc
index 7d5b8eaec278def834e967ac581897ce1ad85c3e..f355c8808e6fc8a2418828d12014bd38355c029c 100644
--- a/net/base/fuzzer_test_support.cc
+++ b/net/base/fuzzer_test_support.cc
@@ -6,6 +6,7 @@
#include "base/i18n/icu_util.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/statistics_recorder.h"
namespace {
@@ -19,6 +20,10 @@ struct InitGlobals {
// //net code. Initializing ICU is important to prevent fuzztests from
// asserting when handling non-ASCII urls.
CHECK(base::i18n::InitializeICU());
+
+ // Prevent every call to get a Histogram* from leaking memory. Instead, only
+ // the fist call to get each Histogram* leaks memory.
+ base::StatisticsRecorder::Initialize();
}
// A number of tests use async code which depends on there being a message
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698