forked from enlightenment/efl
fix memory leak in Eina_Strbuf usage
buf was not freed on error, and never on success CID 1194715
This commit is contained in:
parent
70092ae92e
commit
82b852850f
|
@ -4362,6 +4362,8 @@ EAPI const Eina_List *edje_edit_script_error_list_get(Evas_Object *obj);
|
||||||
/**
|
/**
|
||||||
* Return source code of the current edje edit object.
|
* Return source code of the current edje edit object.
|
||||||
*
|
*
|
||||||
|
* Remember to free the string with edje_edit_string_free()
|
||||||
|
*
|
||||||
* This function will return source code of the whole group, loaded previously.
|
* This function will return source code of the whole group, loaded previously.
|
||||||
* This function also will collect all possible resources that is required and
|
* This function also will collect all possible resources that is required and
|
||||||
* mentioned in description blocks. For example: all images, fonts, data, styles,
|
* mentioned in description blocks. For example: all images, fonts, data, styles,
|
||||||
|
|
|
@ -7534,7 +7534,8 @@ edje_edit_source_generate(Evas_Object *obj)
|
||||||
Edje_Part_Description_Text *part_desc_text;
|
Edje_Part_Description_Text *part_desc_text;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
const char *entry;
|
const char *entry;
|
||||||
Eina_Strbuf *buf = eina_strbuf_new();
|
const char *str;
|
||||||
|
Eina_Strbuf *buf = NULL;
|
||||||
Eina_Bool ret = EINA_TRUE;
|
Eina_Bool ret = EINA_TRUE;
|
||||||
Eina_List *images = NULL, *color_classes = NULL, *styles = NULL, *fonts = NULL;
|
Eina_List *images = NULL, *color_classes = NULL, *styles = NULL, *fonts = NULL;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
@ -7602,6 +7603,8 @@ edje_edit_source_generate(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf = eina_strbuf_new();
|
||||||
|
|
||||||
/* if images were found, print them */
|
/* if images were found, print them */
|
||||||
if (images)
|
if (images)
|
||||||
{
|
{
|
||||||
|
@ -7659,11 +7662,14 @@ edje_edit_source_generate(Evas_Object *obj)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
ERR("Generating EDC for This Group.");
|
ERR("Generating EDC for This Group.");
|
||||||
|
eina_strbuf_free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return resulted source code of the group */
|
/* return resulted source code of the group */
|
||||||
return eina_strbuf_string_get(buf);
|
str = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||||
|
eina_strbuf_free(buf);
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef COLLECT_RESOURCE
|
#undef COLLECT_RESOURCE
|
||||||
|
|
Loading…
Reference in New Issue