From 9c7ca65d21561a55110c8ce9cab9d376e130004b Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Mon, 24 Nov 2014 15:03:08 -0800 Subject: [PATCH] free builders in VersionSet::DumpManifest Summary: Reported by bootcamper This causes ldb tool to fail the assertion in ~ColumnFamilyData() Test Plan: ./ldb --db=/tmp/test_db1 --create_if_missing put a1 b1 ./ldb manifest_dump --path=/tmp/test_db1/MANIFEST-000001 Reviewers: sdong, yhchiang, rven, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29517 --- db/version_set.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/version_set.cc b/db/version_set.cc index db8808687..f71ffce95 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2436,7 +2436,6 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname, v->storage_info()->num_levels() - 1); cfd->compaction_picker()->SizeBeingCompacted(size_being_compacted); v->PrepareApply(*cfd->GetLatestMutableCFOptions(), size_being_compacted); - delete builder; printf("--------------- Column family \"%s\" (ID %u) --------------\n", cfd->GetName().c_str(), (unsigned int)cfd->GetID()); @@ -2451,6 +2450,11 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname, delete v; } + // Free builders + for (auto& builder : builders) { + delete builder.second; + } + next_file_number_.store(next_file + 1); last_sequence_ = last_sequence; prev_log_number_ = previous_log_number;