Fix potential memory leak in table_test (#6611)

Summary:
The checksum generator should be released if file_writer fails to reset the pointer.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6611

Test Plan: pass make asan_check

Reviewed By: riversand963

Differential Revision: D20742964

Pulled By: zhichao-cao

fbshipit-source-id: cde41be2edb3d1e56083c2b93e1510fb32556146
main
Zhichao Cao 5 years ago committed by Facebook GitHub Bot
parent cb671ea1ca
commit 2ae91c6097
  1. 2
      table/table_test.cc

@ -1190,6 +1190,8 @@ class FileChecksumTestHelper {
void SetFileChecksumGenerator(FileChecksumGenerator* checksum_generator) {
if (file_writer_ != nullptr) {
file_writer_->TEST_SetFileChecksumGenerator(checksum_generator);
} else {
delete checksum_generator;
}
}

Loading…
Cancel
Save