From 4d107b2c4b2a5161b6e113fb60e283017b700255 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Wed, 22 Jan 2014 09:56:02 +0100 Subject: Release inhibitor on sleep and shutdown. Also fix a memory leak in login1_inhibit_cb. [The intention was to hold one "ref" to the inhibit fd for each connection that was waiting to disconnect, plus one "ref" for the idle state of "waiting to be notified by logind". We correctly took one "ref" per connection, but did not release the extra one. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73599 Reviewed-by: Simon McVittie --- src/connectivity-monitor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c index 682dfa19..8b3d3856 100644 --- a/src/connectivity-monitor.c +++ b/src/connectivity-monitor.c @@ -343,6 +343,8 @@ login1_inhibit_cb (GObject *source G_GNUC_UNUSED, { DEBUG ("Inhibit() didn't return enough fds?"); } + + g_variant_unref (tuple); } else { @@ -400,6 +402,7 @@ login1_prepare_for_sleep_cb (GDBusConnection *system_bus G_GNUC_UNUSED, DEBUG ("about to suspend"); connectivity_monitor_remove_states (self, CONNECTIVITY_AWAKE, self->priv->login1_inhibit); + tp_clear_pointer (&self->priv->login1_inhibit, mcd_inhibit_release); } else { @@ -440,6 +443,7 @@ login1_prepare_for_shutdown_cb (GDBusConnection *system_bus G_GNUC_UNUSED, DEBUG ("about to shut down"); connectivity_monitor_remove_states (self, CONNECTIVITY_RUNNING, self->priv->login1_inhibit); + tp_clear_pointer (&self->priv->login1_inhibit, mcd_inhibit_release); } else { -- cgit v1.2.1