Fixed a large memory leak in the scraper.

This commit is contained in:
Leon Styhre 2021-03-15 20:11:01 +01:00
parent c3d5614cfc
commit 87cc3e88d2

View file

@ -498,8 +498,10 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight)
// If the image is smaller than maxWidth or maxHeight, then don't do any
// scaling. It doesn't make sense to upscale the image and waste disk space.
if (maxWidth > width || maxHeight > height)
if (maxWidth > width || maxHeight > height) {
FreeImage_Unload(image);
return true;
}
if (maxWidth == 0)
maxWidth = static_cast<int>((maxHeight / height) * width);