Canvas text: fix leak in annotation_insert
authorDaniel Hirt <daniel.hirt@samsung.com>
Thu, 30 Jun 2016 19:37:02 +0000 (19:37 +0000)
committerDaniel Hirt <daniel.hirt@samsung.com>
Sun, 3 Jul 2016 17:10:56 +0000 (17:10 +0000)
src/lib/evas/canvas/evas_object_textblock.c

index ed2557d..6025bbf 100644 (file)
@@ -13926,24 +13926,23 @@ _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
         eina_strbuf_append_length(buf, item, itlen);
      }
 
-   format = eina_strbuf_string_steal(buf);
-   if (!format || (format[0] == '\0'))
+   format = eina_strbuf_string_get(buf);
+   if (format && (format[0] != '\0'))
      {
-        return NULL;
-     }
+        ret = calloc(1, sizeof(Efl_Canvas_Text_Annotation));
+        ret->obj = eo_obj;
 
-   ret = calloc(1, sizeof(Efl_Canvas_Text_Annotation));
-   ret->obj = eo_obj;
-
-   o->annotations = (Efl_Canvas_Text_Annotation *)
-      eina_inlist_append(EINA_INLIST_GET(o->annotations),
-            EINA_INLIST_GET(ret));
+        o->annotations = (Efl_Canvas_Text_Annotation *)
+           eina_inlist_append(EINA_INLIST_GET(o->annotations),
+                 EINA_INLIST_GET(ret));
 
 
-   _textblock_annotation_set(eo_obj, o, ret, start, end, format, is_item);
-   ret->is_item = is_item;
+        _textblock_annotation_set(eo_obj, o, ret, start, end, format, is_item);
+        ret->is_item = is_item;
+        _evas_textblock_changed(o, eo_obj);
+     }
 
-   _evas_textblock_changed(o, eo_obj);
+   eina_strbuf_free(buf);
 
    return ret;
 }