multibuttonentry/spinner: Fix memory leak when eina_strbuf_string_steal is misused.

Summary:
_elm_access_say() does not free the given text.
But, the text from eina_strbuf_string_steal() is not cared
from outside of _elm_access_say(), too.
It should be changed to eina_strbuf_string_get().

Test Plan: N/A

Reviewers: cedric, woohyun, kimcinoo, JackDanielZ, Hermet

Reviewed By: Hermet

Differential Revision: https://phab.enlightenment.org/D2918
This commit is contained in:
Youngbok Shin 2015-08-07 15:15:45 +09:00 committed by ChunEon Park
parent 84c481a75f
commit 7ba3140373
2 changed files with 5 additions and 12 deletions

View File

@ -463,7 +463,7 @@ _item_select(Evas_Object *obj,
{
Evas_Object *ao, *po;
Eina_Strbuf *buf;
const char *part, *text;
const char *part;
part = "elm.btn.text";
po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), part);
@ -475,8 +475,7 @@ _item_select(Evas_Object *obj,
"multi button entry item %s is selected",
edje_object_part_text_get(elm_layout_edje_get(VIEW(it)), part));
text = (const char*)eina_strbuf_string_steal(buf);
_elm_access_say(text);
_elm_access_say(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
}
}
@ -758,7 +757,6 @@ _item_new(Elm_Multibuttonentry_Data *sd,
// ACCESS
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
{
const char *text;
Eina_Strbuf *buf;
buf = eina_strbuf_new();
@ -766,8 +764,7 @@ _item_new(Elm_Multibuttonentry_Data *sd,
"multi button entry item %s is added",
edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), "elm.btn.text"));
text = (const char*)eina_strbuf_string_steal(buf);
_elm_access_say(text);
_elm_access_say(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
_access_multibuttonentry_item_register(obj, eo_item, EINA_TRUE);

View File

@ -788,10 +788,8 @@ _access_activate_cb(void *data,
eina_strbuf_append_printf(buf, "%s, %s", text,
elm_layout_text_get(data, "elm.text"));
text = eina_strbuf_string_steal(buf);
_elm_access_say(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
_elm_access_say(text);
}
static char *
@ -842,7 +840,6 @@ static void
_access_increment_decrement_info_say(Evas_Object *obj,
Eina_Bool is_incremented)
{
char *text;
Eina_Strbuf *buf;
ELM_SPINNER_DATA_GET(obj, sd);
@ -864,9 +861,8 @@ _access_increment_decrement_info_say(Evas_Object *obj,
eina_strbuf_append_printf
(buf, "%s", elm_object_text_get(sd->text_button));
text = eina_strbuf_string_steal(buf);
_elm_access_say(eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
_elm_access_say(text);
}
static void