Skip to content

Commit

Permalink
util: try to fix leak in filelineiter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jun 19, 2024
1 parent 1c184c5 commit 87626e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ortools/util/filelineiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ class FileLines {
FileLines& operator=(const FileLines&) = delete;

~FileLines() {
if (file_ != nullptr) file_->Close(file::Defaults()).IgnoreError();
if (file_ != nullptr) {
file_->Close(file::Defaults()).IgnoreError();
delete file_;
file_ = nullptr;
}
}

FileLineIterator begin() { return FileLineIterator(file_, options_); }
Expand Down

0 comments on commit 87626e2

Please sign in to comment.