From ccb1bfee378b96e9aa01d02bcf20e50131357edc Mon Sep 17 00:00:00 2001 From: Benign X <1341398182@qq.com> Date: Sat, 23 Dec 2023 10:24:36 +0800 Subject: [PATCH] fix(decoder): fix potential mem leak in image decoder (#5077) --- src/libs/libjpeg_turbo/lv_libjpeg_turbo.c | 1 + src/libs/libpng/lv_libpng.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c index a58be3b04..470485289 100644 --- a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c +++ b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c @@ -172,6 +172,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d decoded->data_size); if(cache == NULL) { lv_cache_unlock(); + lv_draw_buf_destroy(decoded); return LV_RESULT_INVALID; } diff --git a/src/libs/libpng/lv_libpng.c b/src/libs/libpng/lv_libpng.c index 189bd6f0c..3876ceca4 100644 --- a/src/libs/libpng/lv_libpng.c +++ b/src/libs/libpng/lv_libpng.c @@ -162,6 +162,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d lv_cache_entry_t * cache = lv_cache_add(decoded, 0, decoder->cache_data_type, decoded->data_size); if(cache == NULL) { lv_cache_unlock(); + lv_draw_buf_destroy(decoded); return LV_RESULT_INVALID; }