From 63f824c6599fd58fd1427a68569440b37f03769f Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Sat, 7 Dec 2013 14:07:29 +0100 Subject: [PATCH] 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 --- src/bin/eldbus/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/eldbus/parser.c b/src/bin/eldbus/parser.c index 73e4f41..a74ff07 100644 --- a/src/bin/eldbus/parser.c +++ b/src/bin/eldbus/parser.c @@ -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); -- 2.7.4