eldbus: create object when needed

We allocate the strbuf at the beginning of the function, but do several
return checks after this which does not free the strbuf before return,
and we don't use the strbuf.

So create the strbuf object after checks, just before we need it.

Fixes CID 1039287
This commit is contained in:
Sebastian Dransfeld 2013-12-07 14:07:29 +01:00
parent 08978ddb56
commit 63f824c659
1 changed files with 2 additions and 1 deletions

View File

@ -199,7 +199,7 @@ open_signal(const char *content, unsigned length, Eina_Bool is_open_empty)
Eina_Bool r;
char *tmp;
int i;
Eina_Strbuf *buf = eina_strbuf_new();
Eina_Strbuf *buf;
d_signal = signal_new(iface);
EINA_SAFETY_ON_NULL_RETURN_VAL(d_signal, EINA_FALSE);
@ -213,6 +213,7 @@ open_signal(const char *content, unsigned length, Eina_Bool is_open_empty)
return EINA_FALSE;
}
buf = eina_strbuf_new();
tmp = dbus_name_to_c(d_signal->name);
d_signal->c_name = string_build("%s_%s", iface->c_name, tmp);
free(tmp);