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
main
Peter (Stig) Edwards 8 years ago committed by Facebook Github Bot
parent 253799c06d
commit 2ca2059f66
  1. 2
      db/db_impl.cc

@ -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, "");

Loading…
Cancel
Save