edje_entry: avoid memory leak on error path
In commit 8cb0b193ea
the logic was changed and we could return here
without free'ing the plain_text resource we allocated. Make sure we
handle this even on the error case and early return.
CID: 1408481
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11433
This commit is contained in:
parent
ce912f688e
commit
127461549e
|
@ -4739,7 +4739,11 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
|
||||||
char *itr = NULL;
|
char *itr = NULL;
|
||||||
size_t len = eina_unicode_utf8_get_len(plain_text);
|
size_t len = eina_unicode_utf8_get_len(plain_text);
|
||||||
char *u_text = (char *)malloc(len * sizeof(char) + 1);
|
char *u_text = (char *)malloc(len * sizeof(char) + 1);
|
||||||
if (!u_text) return EINA_FALSE;
|
if (!u_text)
|
||||||
|
{
|
||||||
|
free(plain_text);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
itr = u_text;
|
itr = u_text;
|
||||||
while (eina_unicode_utf8_next_get(plain_text, &idx))
|
while (eina_unicode_utf8_next_get(plain_text, &idx))
|
||||||
|
|
Loading…
Reference in New Issue