1
0
Fork 0
forked from mirror/pixelfed

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:
daniel 2023-09-09 15:31:11 -06:00 committed by GitHub
commit 6ec4077549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

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

View file

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