mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-19 04:51:27 +00:00
Merge pull request #4643 from ThisIsMissEm/fix/memory-leak-in-blurhash-calculation
Fix potential memory leak due to not calling imagedestroy on GdImage objects
This commit is contained in:
commit
6ec4077549
2 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue