summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2020-02-14 16:27:12 +0900
committerJunsuChoi <jsuya.choi@samsung.com>2020-02-14 16:27:12 +0900
commit65dae7876d71c2d25bf67a917ac5acab29485154 (patch)
treee0fe1deb7f0c75273afb783a213b838bcb98f7a2 /src/lib/eldbus
parent2ba77c0a3387e530bd1d48184c9f73e318d85b13 (diff)
eldbus_service: Prevent memory leak
Summary: If obj->introspection_data is null, the function returns without freeing the memory. Test Plan: N/A Reviewers: Hermet, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11345
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_service.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/eldbus/eldbus_service.c b/src/lib/eldbus/eldbus_service.c
index 4c7ed640d4..165da86081 100644
--- a/src/lib/eldbus/eldbus_service.c
+++ b/src/lib/eldbus/eldbus_service.c
@@ -365,7 +365,7 @@ cb_introspect(const Eldbus_Service_Interface *_iface, const Eldbus_Message *mess
365 eina_strbuf_reset(obj->introspection_data); 365 eina_strbuf_reset(obj->introspection_data);
366 else 366 else
367 obj->introspection_data = eina_strbuf_new(); 367 obj->introspection_data = eina_strbuf_new();
368 EINA_SAFETY_ON_NULL_RETURN_VAL(obj->introspection_data, NULL); 368 EINA_SAFETY_ON_NULL_GOTO(obj->introspection_data, fail);
369 369
370 eina_strbuf_append(obj->introspection_data, "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">"); 370 eina_strbuf_append(obj->introspection_data, "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">");
371 eina_strbuf_append_printf(obj->introspection_data, 371 eina_strbuf_append_printf(obj->introspection_data,
@@ -392,6 +392,9 @@ cb_introspect(const Eldbus_Service_Interface *_iface, const Eldbus_Message *mess
392 392
393 eldbus_message_arguments_append(reply, "s", eina_strbuf_string_get(obj->introspection_data)); 393 eldbus_message_arguments_append(reply, "s", eina_strbuf_string_get(obj->introspection_data));
394 return reply; 394 return reply;
395fail:
396 if (reply) eldbus_message_unref(reply);
397 return NULL;
395} 398}
396 399
397static const Eldbus_Method introspect = { 400static const Eldbus_Method introspect = {