[polkit] Don't leak file descriptors (bgo #671486)

David Zeuthen davidz at fedoraproject.org
Thu Mar 8 20:41:07 UTC 2012


commit fac5a3ac3f2b82b2dd14c3796b5b32db39f28188
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Mar 8 15:40:59 2012 -0500

    Don't leak file descriptors (bgo #671486)

 ...tAgentSession-Don-t-leak-file-descriptors.patch |   49 ++++++++++++++++++++
 polkit.spec                                        |    7 ++-
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/0001-PolkitAgentSession-Don-t-leak-file-descriptors.patch b/0001-PolkitAgentSession-Don-t-leak-file-descriptors.patch
new file mode 100644
index 0000000..8b860b9
--- /dev/null
+++ b/0001-PolkitAgentSession-Don-t-leak-file-descriptors.patch
@@ -0,0 +1,49 @@
+From 4aa6dd28476e12a5265d71b6bc19c730f1036785 Mon Sep 17 00:00:00 2001
+From: David Zeuthen <davidz at redhat.com>
+Date: Thu, 8 Mar 2012 15:36:30 -0500
+Subject: [PATCH] PolkitAgentSession: Don't leak file descriptors
+
+This was reported here
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=671486
+
+Signed-off-by: David Zeuthen <davidz at redhat.com>
+---
+ src/polkitagent/polkitagentsession.c |   14 ++++++++++++++
+ 1 files changed, 14 insertions(+), 0 deletions(-)
+
+diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c
+index ad3bbc3..8129cd9 100644
+--- a/src/polkitagent/polkitagentsession.c
++++ b/src/polkitagent/polkitagentsession.c
+@@ -130,6 +130,8 @@ G_DEFINE_TYPE (PolkitAgentSession, polkit_agent_session, G_TYPE_OBJECT);
+ static void
+ polkit_agent_session_init (PolkitAgentSession *session)
+ {
++  session->child_stdin = -1;
++  session->child_stdout = -1;
+ }
+ 
+ static void kill_helper (PolkitAgentSession *session);
+@@ -395,6 +397,18 @@ kill_helper (PolkitAgentSession *session)
+       session->child_stdout_channel = NULL;
+     }
+ 
++  if (session->child_stdout != -1)
++    {
++      g_warn_if_fail (close (session->child_stdout) == 0);
++      session->child_stdout = -1;
++    }
++
++  if (session->child_stdin != -1)
++    {
++      g_warn_if_fail (close (session->child_stdin) == 0);
++      session->child_stdin = -1;
++    }
++
+   session->helper_is_running = FALSE;
+ 
+  out:
+-- 
+1.7.9.1
+
diff --git a/polkit.spec b/polkit.spec
index 4d1151d..0e72849 100644
--- a/polkit.spec
+++ b/polkit.spec
@@ -1,7 +1,7 @@
 Summary: PolicyKit Authorization Framework
 Name: polkit
 Version: 0.104
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: LGPLv2+
 URL: http://www.freedesktop.org/wiki/Software/PolicyKit
 Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
@@ -28,6 +28,7 @@ Provides: polkit-desktop-policy = 0.103
 
 Patch0: 0001-PolkitUnixSession-Set-error-if-we-cannot-find-a-sess.patch
 Patch1: 0002-PolkitUnixSession-Actually-return-TRUE-if-a-session-.patch
+Patch2: 0001-PolkitAgentSession-Don-t-leak-file-descriptors.patch
 
 %description
 PolicyKit is a toolkit for defining and handling authorizations.
@@ -60,6 +61,7 @@ Development documentation for PolicyKit.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %configure --enable-gtk-doc \
@@ -130,6 +132,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/polkit-1/extensions/*.la
 %{_datadir}/gtk-doc
 
 %changelog
+* Thu Mar 08 2012 David Zeuthen <davidz at redhat.com> 0.104-5%{?dist}
+- Don't leak file descriptors (bgo #671486)
+
 * Mon Feb 06 2012 David Zeuthen <davidz at redhat.com> 0.104-4%{?dist}
 - Set error if we cannot obtain a PolkitUnixSession for a given PID (#787222)
 


More information about the scm-commits mailing list