Reclaim memory allocated to backup_engine.

Summary: Closes https://github.com/facebook/rocksdb/pull/4045

Differential Revision: D8595609

Pulled By: riversand963

fbshipit-source-id: 5ba5954d804b82b0e7264b2e18e1da4c94103b53
main
Yanqin Jin 6 years ago committed by Facebook Github Bot
parent 80ade9ad83
commit 2729dd72ad
  1. 5
      tools/db_stress.cc

@ -1805,7 +1805,7 @@ class StressTest {
thread->rand.Uniform(FLAGS_backup_one_in) == 0) { thread->rand.Uniform(FLAGS_backup_one_in) == 0) {
std::string backup_dir = FLAGS_db + "/.backup" + ToString(thread->tid); std::string backup_dir = FLAGS_db + "/.backup" + ToString(thread->tid);
BackupableDBOptions backup_opts(backup_dir); BackupableDBOptions backup_opts(backup_dir);
BackupEngine* backup_engine; BackupEngine* backup_engine = nullptr;
Status s = BackupEngine::Open(FLAGS_env, backup_opts, &backup_engine); Status s = BackupEngine::Open(FLAGS_env, backup_opts, &backup_engine);
if (s.ok()) { if (s.ok()) {
s = backup_engine->CreateNewBackup(db_); s = backup_engine->CreateNewBackup(db_);
@ -1817,6 +1817,9 @@ class StressTest {
printf("A BackupEngine operation failed with: %s\n", printf("A BackupEngine operation failed with: %s\n",
s.ToString().c_str()); s.ToString().c_str());
} }
if (backup_engine != nullptr) {
delete backup_engine;
}
} }
if (FLAGS_compact_files_one_in > 0 && if (FLAGS_compact_files_one_in > 0 &&

Loading…
Cancel
Save