From 375783236b2a9936c30feb3cf270983473a5d334 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Tue, 12 Sep 2017 14:29:49 +0900 Subject: [PATCH] Add finishing jpeg decompression due to memory leak - The libjpeg release memory without stdio manager during compression So we should finish decompression before release jpeg source. If release jpeg decompression without finishing, jpeg_destroy_decompress makes memory leak. Change-Id: Ic19ea9935edc0c461c7dcfad7670cd551f0525cc Signed-off-by: Jiyong Min --- jpeg/mm_util_jpeg.c | 4 ++++ packaging/libmm-utility.spec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jpeg/mm_util_jpeg.c b/jpeg/mm_util_jpeg.c index 8886a35..95fc080 100755 --- a/jpeg/mm_util_jpeg.c +++ b/jpeg/mm_util_jpeg.c @@ -997,6 +997,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) { decoded_data->size = dinfo.output_height * dinfo.output_width; } else{ + jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); mm_util_error("[%d] We can't decode the IMAGE format", input_fmt); fclose(infile); @@ -1007,6 +1008,7 @@ static int __mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data->format = input_fmt; if (decoded_data->data == NULL) { + jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); mm_util_error("decoded_data->data is NULL"); fclose(infile); @@ -1180,6 +1182,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data } else if (input_fmt == MM_UTIL_JPEG_FMT_GraySacle) { decoded_data->size = dinfo.output_height * dinfo.output_width; } else{ + jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); mm_util_error("[%d] We can't decode the IMAGE format", input_fmt); return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT; @@ -1189,6 +1192,7 @@ static int __mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data decoded_data->format = input_fmt; if (decoded_data->data == NULL) { + jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); mm_util_error("decoded_data->data is NULL"); return MM_UTIL_ERROR_OUT_OF_MEMORY; diff --git a/packaging/libmm-utility.spec b/packaging/libmm-utility.spec index 65cb041..ef92872 100755 --- a/packaging/libmm-utility.spec +++ b/packaging/libmm-utility.spec @@ -1,6 +1,6 @@ Name: libmm-utility Summary: Multimedia Framework Utility Library -Version: 0.40 +Version: 0.41 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.7.4