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:
Stefan Schmidt 2020-02-27 10:16:00 +01:00
parent ce912f688e
commit 127461549e
1 changed files with 5 additions and 1 deletions

View File

@ -4739,7 +4739,11 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
char *itr = NULL;
size_t len = eina_unicode_utf8_get_len(plain_text);
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;
while (eina_unicode_utf8_next_get(plain_text, &idx))