handle->node_info = g_dbus_node_info_new_for_xml(xml, &err);
if (!handle->node_info) {
_E("Failed to make node_info : %s", err->message);
- free(handle);
- return RESOURCED_ERROR_FAIL;
+ goto on_error;
}
handle->subscription_id = g_dbus_connection_register_object(d_bus_get_connection(),
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);
- free(handle);
- return RESOURCED_ERROR_FAIL;
+ goto on_error;
} else
dbus_method_handle_list = g_list_append(dbus_method_handle_list, (gpointer)handle);
return RESOURCED_ERROR_NONE;
+
+on_error:
+ g_clear_error(&err);
+ free(handle);
+
+ return RESOURCED_ERROR_FAIL;
}
resourced_ret_c d_bus_register_signals(const struct d_bus_signal *signals, const size_t size)
if (!g_dbus_connection_send_message(d_bus_get_connection(), msg,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, &err)) {
_E("Fail to reply gdbus message");
+ g_clear_error(&err);
return RESOURCED_ERROR_FAIL;
}
+ g_clear_error(&err);
return RESOURCED_ERROR_NONE;
}