From dd42f1e418addaedbeeff9602520288edf3c7108 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 9 Dec 2008 16:15:18 -0500 Subject: Fix dbus related memory leaks --- server/monitor.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'server/monitor.c') diff --git a/server/monitor.c b/server/monitor.c index 0075aac74..38510f17c 100644 --- a/server/monitor.c +++ b/server/monitor.c @@ -508,6 +508,7 @@ static int dbus_service_init(struct sbus_conn_ctx *conn_ctx, void *data) * We'll drop it using the default destructor. */ DEBUG(0, ("D-BUS send failed.\n")); + dbus_message_unref(msg); talloc_free(conn_ctx); return EIO; } @@ -545,7 +546,7 @@ static void identity_check(DBusPendingCall *pending, void *data) /* Destroy this connection */ sbus_disconnect(conn_ctx); - return; + goto done; } type = dbus_message_get_type(reply); @@ -558,7 +559,7 @@ static void identity_check(DBusPendingCall *pending, void *data) if (!ret) { DEBUG(1,("Failed, to parse message, killing connection\n")); sbus_disconnect(conn_ctx); - return; + goto done; } /* search this service in the list */ @@ -573,7 +574,7 @@ static void identity_check(DBusPendingCall *pending, void *data) if (!svc) { DEBUG(0,("Unable to find peer in list of services, killing connection!\n")); sbus_disconnect(conn_ctx); - return; + goto done; } /* transfer all from the fake service and get rid of it */ @@ -599,6 +600,10 @@ static void identity_check(DBusPendingCall *pending, void *data) sbus_disconnect(conn_ctx); return; } + +done: + dbus_pending_call_unref(pending); + dbus_message_unref(reply); } /* service_send_ping @@ -681,7 +686,7 @@ static void ping_check(DBusPendingCall *pending, void *data) /* Destroy this connection */ sbus_disconnect(conn_ctx); - return; + goto done; } type = dbus_message_get_type(reply); @@ -713,8 +718,11 @@ static void ping_check(DBusPendingCall *pending, void *data) * We'll destroy it now. */ sbus_disconnect(conn_ctx); - return; } + +done: + dbus_pending_call_unref(pending); + dbus_message_unref(reply); } /* service_check_alive -- cgit