|
|
d7c4bc |
From 7e4630ced2be4b7ecdfb9d60cfe0e0d3de594411 Mon Sep 17 00:00:00 2001
|
|
|
d7c4bc |
From: Bastien Nocera <hadess@hadess.net>
|
|
|
d7c4bc |
Date: Mon, 27 Jan 2014 12:24:14 +0100
|
|
|
d7c4bc |
Subject: [PATCH] pam: Fix eventfd leak
|
|
|
d7c4bc |
|
|
|
d7c4bc |
When we create our own GMainContext, we need to be the ones
|
|
|
d7c4bc |
disposing of it as well, as GMainLoop won't take ownership of it.
|
|
|
d7c4bc |
|
|
|
d7c4bc |
From https://bugzilla.redhat.com/show_bug.cgi?id=1050827
|
|
|
d7c4bc |
---
|
|
|
d7c4bc |
pam/pam_fprintd.c | 15 +++++++++++++--
|
|
|
d7c4bc |
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
d7c4bc |
|
|
|
d7c4bc |
diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c
|
|
|
d7c4bc |
index 0f5e5a4..07302a1 100644
|
|
|
d7c4bc |
--- a/pam/pam_fprintd.c
|
|
|
d7c4bc |
+++ b/pam/pam_fprintd.c
|
|
|
d7c4bc |
@@ -170,6 +170,17 @@ static void close_and_unref (DBusGConnection *connection)
|
|
|
d7c4bc |
dbus_g_connection_unref (connection);
|
|
|
d7c4bc |
}
|
|
|
d7c4bc |
|
|
|
d7c4bc |
+static void unref_loop (GMainLoop *loop)
|
|
|
d7c4bc |
+{
|
|
|
d7c4bc |
+ GMainContext *ctx;
|
|
|
d7c4bc |
+
|
|
|
d7c4bc |
+ /* The main context was created separately, so
|
|
|
d7c4bc |
+ * we'll need to unref it ourselves */
|
|
|
d7c4bc |
+ ctx = g_main_loop_get_context (loop);
|
|
|
d7c4bc |
+ g_main_loop_unref (loop);
|
|
|
d7c4bc |
+ g_main_context_unref (ctx);
|
|
|
d7c4bc |
+}
|
|
|
d7c4bc |
+
|
|
|
d7c4bc |
#define DBUS_TYPE_G_OBJECT_PATH_ARRAY (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH))
|
|
|
d7c4bc |
|
|
|
d7c4bc |
static DBusGProxy *open_device(pam_handle_t *pamh, DBusGConnection *connection, DBusGProxy *manager, const char *username, gboolean *has_multiple_devices)
|
|
|
d7c4bc |
@@ -397,13 +408,13 @@ static int do_auth(pam_handle_t *pamh, const char *username)
|
|
|
d7c4bc |
dev = open_device(pamh, connection, manager, username, &has_multiple_devices);
|
|
|
d7c4bc |
g_object_unref (manager);
|
|
|
d7c4bc |
if (!dev) {
|
|
|
d7c4bc |
- g_main_loop_unref (loop);
|
|
|
d7c4bc |
+ unref_loop (loop);
|
|
|
d7c4bc |
close_and_unref (connection);
|
|
|
d7c4bc |
return PAM_AUTHINFO_UNAVAIL;
|
|
|
d7c4bc |
}
|
|
|
d7c4bc |
ret = do_verify(loop, pamh, dev, has_multiple_devices);
|
|
|
d7c4bc |
|
|
|
d7c4bc |
- g_main_loop_unref (loop);
|
|
|
d7c4bc |
+ unref_loop (loop);
|
|
|
d7c4bc |
release_device(pamh, dev);
|
|
|
d7c4bc |
g_object_unref (dev);
|
|
|
d7c4bc |
close_and_unref (connection);
|
|
|
d7c4bc |
--
|
|
|
d7c4bc |
1.9.0
|
|
|
d7c4bc |
|