forked from enlightenment/efl
fix memory leak in Eina_Strbuf usage
buf wasn't freed on success neighter on edje_edit_image_compression_type_get(...) failure CID 1194716
This commit is contained in:
parent
adbb9ca1e3
commit
70092ae92e
|
@ -7488,7 +7488,7 @@ _edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf);
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf);
|
_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf);
|
||||||
|
|
||||||
static const char *
|
static Eina_Strbuf *
|
||||||
_edje_generate_image_source(Evas_Object *obj, const char *entry)
|
_edje_generate_image_source(Evas_Object *obj, const char *entry)
|
||||||
{
|
{
|
||||||
Eina_Strbuf *buf = eina_strbuf_new();
|
Eina_Strbuf *buf = eina_strbuf_new();
|
||||||
|
@ -7496,7 +7496,7 @@ _edje_generate_image_source(Evas_Object *obj, const char *entry)
|
||||||
if (!buf) return NULL;
|
if (!buf) return NULL;
|
||||||
|
|
||||||
int comp = edje_edit_image_compression_type_get(obj, entry);
|
int comp = edje_edit_image_compression_type_get(obj, entry);
|
||||||
if (comp < 0) return NULL;
|
if (comp < 0) goto error;
|
||||||
|
|
||||||
BUF_APPENDF("image: \"%s\" ", entry);
|
BUF_APPENDF("image: \"%s\" ", entry);
|
||||||
|
|
||||||
|
@ -7513,14 +7513,14 @@ _edje_generate_image_source(Evas_Object *obj, const char *entry)
|
||||||
else
|
else
|
||||||
BUF_APPEND("COMP;\n");
|
BUF_APPEND("COMP;\n");
|
||||||
|
|
||||||
if (!ret)
|
if (!ret) goto error;
|
||||||
{
|
|
||||||
ERR("Generating EDC for Image");
|
|
||||||
eina_strbuf_free(buf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eina_strbuf_string_get(buf);
|
return buf;
|
||||||
|
|
||||||
|
error:
|
||||||
|
ERR("Generating EDC for Image");
|
||||||
|
eina_strbuf_free(buf);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7609,9 +7609,11 @@ edje_edit_source_generate(Evas_Object *obj)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(images, l, entry)
|
EINA_LIST_FOREACH(images, l, entry)
|
||||||
{
|
{
|
||||||
const char *image_source = _edje_generate_image_source(obj, entry);
|
Eina_Strbuf *buf = _edje_generate_image_source(obj, entry);
|
||||||
if (!image_source) continue;
|
if (!buf) continue;
|
||||||
BUF_APPENDF(I1"%s", image_source);
|
|
||||||
|
BUF_APPENDF(I1"%s", eina_strbuf_string_get(buf));
|
||||||
|
eina_strbuf_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
BUF_APPEND(I0"}\n\n");
|
BUF_APPEND(I0"}\n\n");
|
||||||
|
@ -8473,10 +8475,11 @@ _edje_generate_source(Evas_Object *obj)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ll, l, entry)
|
EINA_LIST_FOREACH(ll, l, entry)
|
||||||
{
|
{
|
||||||
const char *image_source = _edje_generate_image_source(obj, entry);
|
Eina_Strbuf *buf = _edje_generate_image_source(obj, entry);
|
||||||
if (!image_source) continue;
|
if (!buf) continue;
|
||||||
|
|
||||||
BUF_APPENDF(I1"%s", image_source);
|
BUF_APPENDF(I1"%s", eina_strbuf_string_get(buf));
|
||||||
|
eina_strbuf_free(buf);
|
||||||
}
|
}
|
||||||
BUF_APPEND(I0"}\n\n");
|
BUF_APPEND(I0"}\n\n");
|
||||||
edje_edit_string_list_free(ll);
|
edje_edit_string_list_free(ll);
|
||||||
|
|
Loading…
Reference in New Issue