diff options
author | Kai Blaschke <kai.blaschke@kb-dev.net> | 2024-02-19 20:47:58 +0100 |
---|---|---|
committer | Kai Blaschke <kai.blaschke@kb-dev.net> | 2024-02-19 20:47:58 +0100 |
commit | 42fc1d6714036a2814f1e6ab293eaa0009320ef4 (patch) | |
tree | 340a74ec7fa5fe72d653799062aebc8d87319d88 /source/core/StarImage.cpp | |
parent | 86106b06d60fb7811e271b2299a65a5ecf68620e (diff) |
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.
Diffstat (limited to 'source/core/StarImage.cpp')
-rw-r--r-- | source/core/StarImage.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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<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; |