static void discovery_free(void *user_data)
{
	struct discovery_client *client = user_data;
	struct btd_adapter *adapter = client->adapter;

	DBG("%p", client);

	if (client->watch)
		g_dbus_remove_watch(dbus_conn, client->watch);

	if (client->discovery_filter) {
		free_discovery_filter(client->discovery_filter);
		client->discovery_filter = NULL;
	}

	if (client->msg) {
		if (client == adapter->client) {
			g_dbus_send_message(dbus_conn,
						btd_error_busy(client->msg));
			adapter->client = NULL;
		}
		dbus_message_unref(client->msg);
	}

	g_free(client->owner);
	g_free(client);
}
static void discovery_free(void *user_data)
{
	struct discovery_client *client = user_data;
	struct btd_adapter *adapter = client->adapter;

	DBG("%p", client);

	if (client->watch)
		g_dbus_remove_watch(dbus_conn, client->watch);

	if (client->discovery_filter) {
		free_discovery_filter(client->discovery_filter);
		client->discovery_filter = NULL;
	}

	if (client->msg) {
		if (client == adapter->client) {
			g_dbus_send_message(dbus_conn,
						btd_error_busy(client->msg));
			adapter->client = NULL;
		}
		dbus_message_unref(client->msg);
	}

	g_free(client->owner);
	g_free(client);
}