From 1e45317ad5d3260d3f5b7660f8efc6cbc50fb6cd Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Mon, 30 Dec 2019 11:57:39 +0900 Subject: [PATCH] elm_entry: fix resource leak This patch will rexolve a resource leak detected by static analysis tool. The evas_textblock_cursor_range_text_get allocates memory, so returned value 'text' should be released before it refers different address. In this case, 'text' points different address by calling eina_strbuf_string_steal. Change-Id: I9b3912e4f9476b9ee400da5598037274afdf03ab --- src/lib/elementary/elm_entry.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index cd46969..2f7e904 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -8277,6 +8277,7 @@ _atspi_expose_anchors(Eo *obj, Eina_Bool is_screen_reader) start, end, EVAS_TEXTBLOCK_TEXT_PLAIN); //TIZEN_ONLY(20191216): link not read, so adding link to entry eina_strbuf_append_printf(buf, "%s, %s", text, E_("WDS_ACCS_TBOPT_LINK")); + if (text) free(text); text = eina_strbuf_string_steal(buf); eina_strbuf_free(buf); // -- 2.7.4