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
main
Zhichao Cao 4 years ago committed by Facebook GitHub Bot
parent 55e99688cc
commit 601585bca4
  1. 4
      db_stress_tool/db_stress_test_base.cc

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

Loading…
Cancel
Save