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
This commit is contained in:
kailiu 2014-02-26 19:04:14 -08:00
parent 444cafc28c
commit e41c060a06

View File

@ -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<AutoRollLogger> logger_guard(
new AutoRollLogger(Env::Default(), kTestDir, "", log_size, 0));
auto logger = logger_guard.get();
int message_length = kSampleMessage.length();
int log_length = 0;