jsuya pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=65dae7876d71c2d25bf67a917ac5acab29485154
commit 65dae7876d71c2d25bf67a917ac5acab29485154 Author: JunsuChoi <[email protected]> Date: Fri Feb 14 16:27:12 2020 +0900 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 --- src/lib/eldbus/eldbus_service.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 eina_strbuf_reset(obj->introspection_data); else obj->introspection_data = eina_strbuf_new(); - EINA_SAFETY_ON_NULL_RETURN_VAL(obj->introspection_data, NULL); + EINA_SAFETY_ON_NULL_GOTO(obj->introspection_data, fail); 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\">"); eina_strbuf_append_printf(obj->introspection_data, @@ -392,6 +392,9 @@ cb_introspect(const Eldbus_Service_Interface *_iface, const Eldbus_Message *mess eldbus_message_arguments_append(reply, "s", eina_strbuf_string_get(obj->introspection_data)); return reply; +fail: + if (reply) eldbus_message_unref(reply); + return NULL; } static const Eldbus_Method introspect = { --
