[access][entry] to read out properly when there is no state value
authorShinwoo Kim <kimcinoo.efl@gmail.com>
Thu, 31 Jan 2013 10:56:18 +0000 (10:56 +0000)
committerShinwoo Kim <kimcinoo.efl@gmail.com>
Thu, 31 Jan 2013 10:56:18 +0000 (10:56 +0000)
SVN revision: 83506

legacy/elementary/src/lib/elm_entry.c

index f732583..2c140ee 100644 (file)
@@ -2633,7 +2633,7 @@ static char *
 _access_state_cb(void *data __UNUSED__, Evas_Object *obj)
 {
    Eina_Strbuf *buf;
-   char *txt;
+   char *ret;
 
    ELM_ENTRY_DATA_GET(obj, sd);
 
@@ -2656,11 +2656,13 @@ _access_state_cb(void *data __UNUSED__, Evas_Object *obj)
         else eina_strbuf_append(buf, ", Password");
      }
 
-   txt = strdup(eina_strbuf_string_get(buf));
-   eina_strbuf_free(buf);
-   if (txt) return txt;
+   if (!eina_strbuf_length_get(buf)) goto buf_free;
 
-   return NULL;
+   ret = eina_strbuf_string_steal(buf);
+
+buf_free:
+   eina_strbuf_free(buf);
+   return ret;
 }
 
 static void