Lines 1-51
Link Here
|
1 |
From 7e4630ced2be4b7ecdfb9d60cfe0e0d3de594411 Mon Sep 17 00:00:00 2001 |
|
|
2 |
From: Bastien Nocera <hadess@hadess.net> |
3 |
Date: Mon, 27 Jan 2014 12:24:14 +0100 |
4 |
Subject: pam: Fix eventfd leak |
5 |
|
6 |
When we create our own GMainContext, we need to be the ones |
7 |
disposing of it as well, as GMainLoop won't take ownership of it. |
8 |
|
9 |
From https://bugzilla.redhat.com/show_bug.cgi?id=1050827 |
10 |
|
11 |
diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c |
12 |
index 0f5e5a4..07302a1 100644 |
13 |
--- pam/pam_fprintd.c |
14 |
+++ pam/pam_fprintd.c |
15 |
@@ -170,6 +170,17 @@ static void close_and_unref (DBusGConnection *connection) |
16 |
dbus_g_connection_unref (connection); |
17 |
} |
18 |
|
19 |
+static void unref_loop (GMainLoop *loop) |
20 |
+{ |
21 |
+ GMainContext *ctx; |
22 |
+ |
23 |
+ /* The main context was created separately, so |
24 |
+ * we'll need to unref it ourselves */ |
25 |
+ ctx = g_main_loop_get_context (loop); |
26 |
+ g_main_loop_unref (loop); |
27 |
+ g_main_context_unref (ctx); |
28 |
+} |
29 |
+ |
30 |
#define DBUS_TYPE_G_OBJECT_PATH_ARRAY (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH)) |
31 |
|
32 |
static DBusGProxy *open_device(pam_handle_t *pamh, DBusGConnection *connection, DBusGProxy *manager, const char *username, gboolean *has_multiple_devices) |
33 |
@@ -397,13 +408,13 @@ static int do_auth(pam_handle_t *pamh, const char *username) |
34 |
dev = open_device(pamh, connection, manager, username, &has_multiple_devices); |
35 |
g_object_unref (manager); |
36 |
if (!dev) { |
37 |
- g_main_loop_unref (loop); |
38 |
+ unref_loop (loop); |
39 |
close_and_unref (connection); |
40 |
return PAM_AUTHINFO_UNAVAIL; |
41 |
} |
42 |
ret = do_verify(loop, pamh, dev, has_multiple_devices); |
43 |
|
44 |
- g_main_loop_unref (loop); |
45 |
+ unref_loop (loop); |
46 |
release_device(pamh, dev); |
47 |
g_object_unref (dev); |
48 |
close_and_unref (connection); |
49 |
-- |
50 |
cgit v0.10.2 |
51 |
|