From c0e1a1b4a47a5acc86aff77c4724bb098887c48f Mon Sep 17 00:00:00 2001 From: win11 Date: Fri, 15 Nov 2024 16:42:58 +0300 Subject: [PATCH] Clean up PNG and JPEG encoding properly --- project/src/graphics/format/JPEG.cpp | 2 ++ project/src/graphics/format/PNG.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/project/src/graphics/format/JPEG.cpp b/project/src/graphics/format/JPEG.cpp index 9253e45aae..2bb290d3b2 100644 --- a/project/src/graphics/format/JPEG.cpp +++ b/project/src/graphics/format/JPEG.cpp @@ -487,6 +487,8 @@ namespace lime { } + jpeg_destroy_compress (&cinfo); + return true; } diff --git a/project/src/graphics/format/PNG.cpp b/project/src/graphics/format/PNG.cpp index 1f3a3a0c06..78aeecde9b 100644 --- a/project/src/graphics/format/PNG.cpp +++ b/project/src/graphics/format/PNG.cpp @@ -237,6 +237,8 @@ namespace lime { if (!info_ptr) { + png_destroy_write_struct (&png_ptr, NULL); + return false; } @@ -310,6 +312,8 @@ namespace lime { } + png_destroy_write_struct (&png_ptr, &info_ptr); + return true; }