Skip to content

Commit

Permalink
Fix ImageType memory leak file not closed (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Dec 11, 2023
1 parent 615167a commit cdf066a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fastapi_storages/integrations/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def process_result_value(
if value is None:
return value

image = Image.open(self.storage.get_path(value))
return StorageImage(
name=value, storage=self.storage, height=image.height, width=image.width
)
with Image.open(self.storage.get_path(value)) as image:
return StorageImage(
name=value, storage=self.storage, height=image.height, width=image.width
)

0 comments on commit cdf066a

Please sign in to comment.