From e173bf9c19a6db054c231faf39f1faa74fc2bcb0 Mon Sep 17 00:00:00 2001 From: Jonah Cohen Date: Wed, 20 Aug 2014 13:52:03 -0700 Subject: [PATCH] Eliminate VersionSet memory leak Summary: ManifestDumpCommand::DoCommand was allocating a VersionSet and never freeing it. Test Plan: make Reviewers: igor Reviewed By: igor Differential Revision: https://reviews.facebook.net/D22221 --- util/ldb_cmd.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index b6e108ccc..75d97470f 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -560,8 +560,8 @@ void ManifestDumpCommand::DoCommand() { // if VersionSet::DumpManifest() depends on any option done by // SanitizeOptions(), we need to initialize it manually. options.db_paths.emplace_back("dummy", 0); - VersionSet* versions = new VersionSet(dbname, &options, sopt, tc.get()); - Status s = versions->DumpManifest(options, file, verbose_, is_key_hex_); + VersionSet versions(dbname, &options, sopt, tc.get()); + Status s = versions.DumpManifest(options, file, verbose_, is_key_hex_); if (!s.ok()) { printf("Error in processing file %s %s\n", manifestfile.c_str(), s.ToString().c_str());