From e41c060a060f34b33634d931e48fe2cf1d85dcc0 Mon Sep 17 00:00:00 2001 From: kailiu Date: Wed, 26 Feb 2014 19:04:14 -0800 Subject: [PATCH] Make sure logger is safely released in `InfoLogLevel` Summary: fix the memory leak that was captured by jenkin build. Test Plan: ran the valgrind test locally Reviewers: yhchiang CC: leveldb Differential Revision: https://reviews.facebook.net/D16389 --- util/auto_roll_logger_test.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/auto_roll_logger_test.cc b/util/auto_roll_logger_test.cc index 4b5bc82438..3cf9cb453f 100755 --- a/util/auto_roll_logger_test.cc +++ b/util/auto_roll_logger_test.cc @@ -244,8 +244,9 @@ TEST(AutoRollLoggerTest, InfoLogLevel) { const int kInfoLogLevelNameLens[5] = {5, 4, 4, 5, 5}; size_t log_size = 8192; - AutoRollLogger* logger = - new AutoRollLogger(Env::Default(), kTestDir, "", log_size, 0); + std::unique_ptr logger_guard( + new AutoRollLogger(Env::Default(), kTestDir, "", log_size, 0)); + auto logger = logger_guard.get(); int message_length = kSampleMessage.length(); int log_length = 0;