summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2017-08-03 17:12:50 +0200
committerRichard Hughes <richard@hughsie.com>2017-08-03 16:21:12 +0100
commit502c63b54944064dfd5f5cc4463bfb3d457a95c0 (patch)
tree6a904ee1a35c7a0bbc4eee3cb8f2eaa302e468ef /src
parent02b117f5adf76f7b8b37f46f7f2ac6077da3587b (diff)
linux: Correctly close inhibitor FD
The unref of the FD list for the inhibitor was missing which means that the FD was leaked and the lock was never released. This means that for each suspend/resume cycle a new inhibitor would be added. Signed-off-by: Richard Hughes <richard@hughsie.com>
Diffstat (limited to 'src')
-rw-r--r--src/linux/up-backend.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c
index c5f8fd9..e7684a2 100644
--- a/src/linux/up-backend.c
+++ b/src/linux/up-backend.c
@@ -475,7 +475,7 @@ static void
up_backend_inhibitor_lock_take (UpBackend *backend)
{
GVariant *out, *input;
- GUnixFDList *fds;
+ GUnixFDList *fds = NULL;
GError *error = NULL;
if (backend->priv->logind_inhibitor_fd > -1) {
@@ -505,11 +505,13 @@ up_backend_inhibitor_lock_take (UpBackend *backend)
if (g_unix_fd_list_get_length (fds) != 1) {
g_warning ("Unexpected values returned by logind's 'Inhibit'");
g_variant_unref (out);
+ g_object_unref (fds);
return;
}
backend->priv->logind_inhibitor_fd = g_unix_fd_list_get (fds, 0, NULL);
g_variant_unref (out);
+ g_object_unref (fds);
g_debug ("Acquired inhibitor lock (%i)", backend->priv->logind_inhibitor_fd);
}