Skip to content

Commit 8d48faa

Browse files
committed
Layers: Close file on layer destruction to prevent ResourceWarning
1 parent 3cb2bf9 commit 8d48faa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

volatility3/framework/layers/physical.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def destroy(self) -> None:
189189
"""Closes the file handle."""
190190
self._file.close()
191191

192+
def __del__(self) -> None:
193+
self.destroy()
194+
192195
@classmethod
193196
def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]:
194197
return [requirements.StringRequirement(name = 'location', optional = False)]

0 commit comments

Comments
 (0)