From 42fc1d6714036a2814f1e6ab293eaa0009320ef4 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Mon, 19 Feb 2024 20:47:58 +0100 Subject: 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. --- source/core/StarImage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/core/StarImage.cpp') diff --git a/source/core/StarImage.cpp b/source/core/StarImage.cpp index 183b00a..f59765a 100644 --- a/source/core/StarImage.cpp +++ b/source/core/StarImage.cpp @@ -184,6 +184,8 @@ tuple 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; -- cgit v1.2.3