fix memory leak in db_stress checkpoint test (#7813)

Summary:
fix memory leak in db_stress checkpoint test. If s is not ok, checkpoint is not deleted, may cause memory leak.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7813

Test Plan: make asan_check

Reviewed By: cheng-chang

Differential Revision: D25702999

Pulled By: zhichao-cao

fbshipit-source-id: 08253b0852835acb8cfd412503cdabf720afb678
This commit is contained in:
Zhichao Cao 2020-12-25 13:14:38 -08:00 committed by Facebook GitHub Bot
parent 55e99688cc
commit 601585bca4

View File

@ -1505,11 +1505,11 @@ Status StressTest::TestCheckpoint(ThreadState* thread,
}
}
}
delete checkpoint;
checkpoint = nullptr;
std::vector<ColumnFamilyHandle*> cf_handles;
DB* checkpoint_db = nullptr;
if (s.ok()) {
delete checkpoint;
checkpoint = nullptr;
Options options(options_);
options.listeners.clear();
std::vector<ColumnFamilyDescriptor> cf_descs;