From 3d539c11316ad051cfb0bf575f6f58e757cc39ae Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Fri, 20 Sep 2019 10:40:01 +0900 Subject: [PATCH] efl_ui : fix possible memory leak on model compressing Summary: fix memory leak of model compressing on binbuf and allocated data. Reviewers: cedric, bu5hm4n, zmike Reviewed By: cedric, zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10037 --- src/lib/elementary/efl_ui_exact_model.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c index eba69854b9..23b97db7e9 100644 --- a/src/lib/elementary/efl_ui_exact_model.c +++ b/src/lib/elementary/efl_ui_exact_model.c @@ -95,10 +95,19 @@ _efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, uns unsigned char *zmem; zmem = calloc(EFL_UI_EXACT_MODEL_CONTENT, sizeof (unsigned int)); - if (!zmem) return compressed; + if (!zmem) + { + if (cbuf) eina_binbuf_free(cbuf); + return compressed; + } tbuf = eina_binbuf_manage_new(zmem, EFL_UI_EXACT_MODEL_CONTENT_LENGTH, EINA_TRUE); - if (!tbuf) return compressed; + if (!tbuf) + { + if (cbuf) eina_binbuf_free(cbuf); + if (zmem) free(zmem); + return compressed; + } z = emile_compress(tbuf, EMILE_LZ4, EMILE_COMPRESSOR_FAST);