Merge pull request #4643 from ThisIsMissEm/fix/memory-leak-in-blurhash-calculation

Fix potential memory leak due to not calling imagedestroy on GdImage objects
pull/4644/head
daniel 2023-09-09 15:31:11 -06:00 zatwierdzone przez GitHub
commit 6ec4077549
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -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);

Wyświetl plik

@ -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;
}
}
}