Fix potential memory leak due to not calling imagedestroy on GdImage objects

This commit is contained in:
Emelia Smith 2023-09-09 22:54:11 +02:00
parent e286f98762
commit 74ad26fee6
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View file

@ -120,6 +120,9 @@ class InstanceService
$pixels[] = $row; $pixels[] = $row;
} }
// Free the allocated GdImage object from memory:
imagedestroy($image);
$components_x = 4; $components_x = 4;
$components_y = 4; $components_y = 4;
$blurhash = Blurhash::encode($pixels, $components_x, $components_y); $blurhash = Blurhash::encode($pixels, $components_x, $components_y);

View file

@ -44,6 +44,9 @@ class Blurhash {
$pixels[] = $row; $pixels[] = $row;
} }
// Free the allocated GdImage object from memory:
imagedestroy($image);
$components_x = 4; $components_x = 4;
$components_y = 4; $components_y = 4;
$blurhash = BlurhashEngine::encode($pixels, $components_x, $components_y); $blurhash = BlurhashEngine::encode($pixels, $components_x, $components_y);