From 127461549ee7492aeed341114483cf78121afaa7 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 27 Feb 2020 10:16:00 +0100 Subject: [PATCH] edje_entry: avoid memory leak on error path In commit 8cb0b193ea0 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 Differential Revision: https://phab.enlightenment.org/D11433 --- src/lib/edje/edje_entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 6afd99472a..5d84b1fbef 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -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))