summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2015-08-07 15:15:45 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-08-07 15:15:45 +0900
commitba7588d21a9ec9f859ef6da6ad0282a30a376df8 (patch)
treebbf36bd7a21f35bd39135e2a447286a12320dd6a
parent12586bc6e8cf9fb97ada6e17496c1d4a12f826fd (diff)
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
-rw-r--r--src/lib/elc_multibuttonentry.c9
-rw-r--r--src/lib/elm_spinner.c8
2 files changed, 5 insertions, 12 deletions
diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 9c8d15a62..f8558a3da 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -463,7 +463,7 @@ _item_select(Evas_Object *obj,
463 { 463 {
464 Evas_Object *ao, *po; 464 Evas_Object *ao, *po;
465 Eina_Strbuf *buf; 465 Eina_Strbuf *buf;
466 const char *part, *text; 466 const char *part;
467 467
468 part = "elm.btn.text"; 468 part = "elm.btn.text";
469 po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), part); 469 po = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), part);
@@ -475,8 +475,7 @@ _item_select(Evas_Object *obj,
475 "multi button entry item %s is selected", 475 "multi button entry item %s is selected",
476 edje_object_part_text_get(elm_layout_edje_get(VIEW(it)), part)); 476 edje_object_part_text_get(elm_layout_edje_get(VIEW(it)), part));
477 477
478 text = (const char*)eina_strbuf_string_steal(buf); 478 _elm_access_say(eina_strbuf_string_get(buf));
479 _elm_access_say(text);
480 eina_strbuf_free(buf); 479 eina_strbuf_free(buf);
481 } 480 }
482 } 481 }
@@ -758,7 +757,6 @@ _item_new(Elm_Multibuttonentry_Data *sd,
758 // ACCESS 757 // ACCESS
759 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) 758 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
760 { 759 {
761 const char *text;
762 Eina_Strbuf *buf; 760 Eina_Strbuf *buf;
763 buf = eina_strbuf_new(); 761 buf = eina_strbuf_new();
764 762
@@ -766,8 +764,7 @@ _item_new(Elm_Multibuttonentry_Data *sd,
766 "multi button entry item %s is added", 764 "multi button entry item %s is added",
767 edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), "elm.btn.text")); 765 edje_object_part_text_get(elm_layout_edje_get(VIEW(item)), "elm.btn.text"));
768 766
769 text = (const char*)eina_strbuf_string_steal(buf); 767 _elm_access_say(eina_strbuf_string_get(buf));
770 _elm_access_say(text);
771 eina_strbuf_free(buf); 768 eina_strbuf_free(buf);
772 769
773 _access_multibuttonentry_item_register(obj, eo_item, EINA_TRUE); 770 _access_multibuttonentry_item_register(obj, eo_item, EINA_TRUE);
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 46e884cf1..255135f25 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -788,10 +788,8 @@ _access_activate_cb(void *data,
788 eina_strbuf_append_printf(buf, "%s, %s", text, 788 eina_strbuf_append_printf(buf, "%s, %s", text,
789 elm_layout_text_get(data, "elm.text")); 789 elm_layout_text_get(data, "elm.text"));
790 790
791 text = eina_strbuf_string_steal(buf); 791 _elm_access_say(eina_strbuf_string_get(buf));
792 eina_strbuf_free(buf); 792 eina_strbuf_free(buf);
793
794 _elm_access_say(text);
795} 793}
796 794
797static char * 795static char *
@@ -842,7 +840,6 @@ static void
842_access_increment_decrement_info_say(Evas_Object *obj, 840_access_increment_decrement_info_say(Evas_Object *obj,
843 Eina_Bool is_incremented) 841 Eina_Bool is_incremented)
844{ 842{
845 char *text;
846 Eina_Strbuf *buf; 843 Eina_Strbuf *buf;
847 844
848 ELM_SPINNER_DATA_GET(obj, sd); 845 ELM_SPINNER_DATA_GET(obj, sd);
@@ -864,9 +861,8 @@ _access_increment_decrement_info_say(Evas_Object *obj,
864 eina_strbuf_append_printf 861 eina_strbuf_append_printf
865 (buf, "%s", elm_object_text_get(sd->text_button)); 862 (buf, "%s", elm_object_text_get(sd->text_button));
866 863
867 text = eina_strbuf_string_steal(buf); 864 _elm_access_say(eina_strbuf_string_get(buf));
868 eina_strbuf_free(buf); 865 eina_strbuf_free(buf);
869 _elm_access_say(text);
870} 866}
871 867
872static void 868static void