hermet pushed a commit to branch elementary-1.15.

http://git.enlightenment.org/core/elementary.git/commit/?id=8746e5ad4b96f7b4cf0c9cdacbb1480458ef832a

commit 8746e5ad4b96f7b4cf0c9cdacbb1480458ef832a
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Fri Aug 7 15:15:45 2015 +0900

    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
---
 src/lib/elc_multibuttonentry.c | 9 +++------
 src/lib/elm_spinner.c          | 8 ++------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 8255e35..3ab5641 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -453,7 +453,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);
@@ -465,8 +465,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);
                }
           }
@@ -748,7 +747,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();
 
@@ -756,8 +754,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);
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 42ff096..9fc90a2 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -776,10 +776,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 *
@@ -830,7 +828,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);
@@ -852,9 +849,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

-- 


Reply via email to