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
This commit is contained in:
parent
cb671ea1ca
commit
2ae91c6097
@ -1190,6 +1190,8 @@ class FileChecksumTestHelper {
|
|||||||
void SetFileChecksumGenerator(FileChecksumGenerator* checksum_generator) {
|
void SetFileChecksumGenerator(FileChecksumGenerator* checksum_generator) {
|
||||||
if (file_writer_ != nullptr) {
|
if (file_writer_ != nullptr) {
|
||||||
file_writer_->TEST_SetFileChecksumGenerator(checksum_generator);
|
file_writer_->TEST_SetFileChecksumGenerator(checksum_generator);
|
||||||
|
} else {
|
||||||
|
delete checksum_generator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user