From 38268cfc515e1f136cabfbcc9a620a2d9c929cda Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 10 Aug 2009 18:39:15 -0400 Subject: Minor fixes --- server/sbus/sssd_dbus_common.c | 18 ++++++++++++------ server/sbus/sssd_dbus_server.c | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'server') diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c index 0c16f9f5..76cb3c20 100644 --- a/server/sbus/sssd_dbus_common.c +++ b/server/sbus/sssd_dbus_common.c @@ -18,12 +18,18 @@ static void sbus_watch_handler(struct tevent_context *ev, { struct sbus_watch_ctx *watch = talloc_get_type(data, struct sbus_watch_ctx); + enum dbus_conn_type type; + union dbus_conn_pointer dbus_p; + + /* conn may get freed inside a handle, save the data we need for later */ + type = watch->conn->type; + dbus_p = watch->conn->dbus; /* Take a reference while handling watch */ - if (watch->conn->type == SBUS_SERVER) { - dbus_server_ref(watch->conn->dbus.server); + if (type == SBUS_SERVER) { + dbus_server_ref(dbus_p.server); } else { - dbus_connection_ref(watch->conn->dbus.conn); + dbus_connection_ref(dbus_p.conn); } /* Fire if readable */ @@ -37,10 +43,10 @@ static void sbus_watch_handler(struct tevent_context *ev, } /* Release reference once done */ - if (watch->conn->type == SBUS_SERVER) { - dbus_server_unref(watch->conn->dbus.server); + if (type == SBUS_SERVER) { + dbus_server_unref(dbus_p.server); } else { - dbus_connection_unref(watch->conn->dbus.conn); + dbus_connection_unref(dbus_p.conn); } } diff --git a/server/sbus/sssd_dbus_server.c b/server/sbus/sssd_dbus_server.c index ef2de106..a859cbab 100644 --- a/server/sbus/sssd_dbus_server.c +++ b/server/sbus/sssd_dbus_server.c @@ -48,7 +48,7 @@ static void sbus_server_init_new_connection(DBusServer *dbus_server, return; } - DEBUG(5,("Adding connection %lX.\n", conn)); + DEBUG(5,("Adding connection %p.\n", dbus_conn)); ret = sbus_init_connection(server, server->ev, dbus_conn, server->server_intf, SBUS_CONN_TYPE_PRIVATE, &conn); -- cgit