Canvas text: fix leak in annotation_insert

This commit is contained in:
Daniel Hirt 2016-06-30 19:37:02 +00:00
parent f7509bbb52
commit 2be6c6b817
1 changed files with 14 additions and 15 deletions

View File

@ -13926,24 +13926,23 @@ _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
eina_strbuf_append_length(buf, item, itlen); eina_strbuf_append_length(buf, item, itlen);
} }
format = eina_strbuf_string_steal(buf); format = eina_strbuf_string_get(buf);
if (!format || (format[0] == '\0')) if (format && (format[0] != '\0'))
{ {
return NULL; 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));
_textblock_annotation_set(eo_obj, o, ret, start, end, format, is_item);
ret->is_item = is_item;
_evas_textblock_changed(o, eo_obj);
} }
ret = calloc(1, sizeof(Efl_Canvas_Text_Annotation)); eina_strbuf_free(buf);
ret->obj = eo_obj;
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;
_evas_textblock_changed(o, eo_obj);
return ret; return ret;
} }