Improve dbus message handling 78/178578/3
authorŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 2 May 2018 13:31:27 +0000 (15:31 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 29 May 2018 13:26:19 +0000 (15:26 +0200)
Change-Id: Ibc679a21c2a6eb588d9dfcfa86b8f5dff3d9016c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
src/common/dbus-handler.c
src/proc-stat/proc-monitor.c

index 8d2ed19fba65b54c4d8479d04b6cc8cc041002fc..9ac48c207a6726e93e9fb724448e79589fc7622f 100644 (file)
@@ -397,6 +397,7 @@ resourced_ret_c d_bus_register_methods(const char *path, const char *xml,
                        path, handle->node_info->interfaces[0], &vtable, (gpointer)handle, NULL, &err);
        if (!handle->subscription_id) {
                _E("Failed to register gdbus methods with path %s : %s", path, err->message);
+               g_dbus_node_info_unref(handle->node_info);
                goto on_error;
        } else
                dbus_method_handle_list = g_list_append(dbus_method_handle_list, (gpointer)handle);
index 1ceb3b19c33240e3c8b29cfe6f169cd6e110bd72..0236bc57bc0df12d59e622339d834153238e13c8 100755 (executable)
@@ -1096,16 +1096,21 @@ static const struct d_bus_signal dbus_signals[] = {
 
 static int proc_dbus_init(void *data)
 {
-       d_bus_register_signals(dbus_signals, ARRAY_SIZE(dbus_signals));
+       resourced_ret_c ret;
 
        /* start watchdog check timer for preveting ANR during booting */
        watchdog_check_timer = g_timeout_source_new_seconds(WATCHDOG_TIMER_INTERVAL);
        g_source_set_callback(watchdog_check_timer, check_watchdog_cb, NULL, NULL);
        g_source_attach(watchdog_check_timer, NULL);
 
-       return d_bus_register_methods(RESOURCED_PATH_PROCESS, dbus_methods_xml,
+       ret = d_bus_register_signals(dbus_signals, ARRAY_SIZE(dbus_signals));
+       if (ret != RESOURCED_ERROR_NONE)
+               goto out;
+
+       ret = d_bus_register_methods(RESOURCED_PATH_PROCESS, dbus_methods_xml,
                        dbus_methods, ARRAY_SIZE(dbus_methods));
-       return 0;
+out:
+       return ret;
 }
 
 static int proc_dbus_exit(void *data)