Fixed a memory leak in Image::readPngMetadata()

The memory allocated by png_create_read_struct() was not freed before exiting the function, wasting lots of memory over time.
This commit is contained in:
Kai Blaschke 2024-02-19 20:47:58 +01:00
parent 86106b06d6
commit 42fc1d6714
No known key found for this signature in database
GPG Key ID: B014B6811527389F

View File

@ -184,6 +184,8 @@ tuple<Vec2U, PixelFormat> Image::readPngMetadata(IODevicePtr device) {
channels += 1;
}
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
Vec2U imageSize{img_width, img_height};
PixelFormat pixelFormat = channels == 3 ? PixelFormat::RGB24 : PixelFormat::RGBA32;