Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarImage.cpp
diff options
context:
space:
mode:
authorKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 20:47:58 +0100
committerKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 20:47:58 +0100
commit42fc1d6714036a2814f1e6ab293eaa0009320ef4 (patch)
tree340a74ec7fa5fe72d653799062aebc8d87319d88 /source/core/StarImage.cpp
parent86106b06d60fb7811e271b2299a65a5ecf68620e (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.cpp2
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;