Get unique_ptr to use delete[] for char[] in DumpMallocStats

Summary:
Avoid mismatched free() / delete / delete [] in DumpMallocStats
Closes https://github.com/facebook/rocksdb/pull/1927

Differential Revision: D4622045

Pulled By: siying

fbshipit-source-id: 1131b30
This commit is contained in:
Peter (Stig) Edwards 2017-02-27 17:22:50 -08:00 committed by Facebook Github Bot
parent 253799c06d
commit 2ca2059f66

View File

@ -604,7 +604,7 @@ static void DumpMallocStats(std::string* stats) {
#ifdef ROCKSDB_JEMALLOC #ifdef ROCKSDB_JEMALLOC
MallocStatus mstat; MallocStatus mstat;
const uint kMallocStatusLen = 1000000; const uint kMallocStatusLen = 1000000;
std::unique_ptr<char> buf{new char[kMallocStatusLen + 1]}; std::unique_ptr<char[]> buf{new char[kMallocStatusLen + 1]};
mstat.cur = buf.get(); mstat.cur = buf.get();
mstat.end = buf.get() + kMallocStatusLen; mstat.end = buf.get() + kMallocStatusLen;
malloc_stats_print(GetJemallocStatus, &mstat, ""); malloc_stats_print(GetJemallocStatus, &mstat, "");