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
This commit is contained in:
SangHyeon Jade Lee 2019-09-20 10:40:01 +09:00
parent 18e9a224be
commit 3d539c1131
1 changed files with 11 additions and 2 deletions

View File

@ -95,10 +95,19 @@ _efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, uns
unsigned char *zmem; unsigned char *zmem;
zmem = calloc(EFL_UI_EXACT_MODEL_CONTENT, sizeof (unsigned int)); 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); 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); z = emile_compress(tbuf, EMILE_LZ4, EMILE_COMPRESSOR_FAST);