diff options
author | David Zeuthen <davidz@redhat.com> | 2012-03-08 15:36:30 -0500 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2012-03-08 15:36:30 -0500 |
commit | 4aa6dd28476e12a5265d71b6bc19c730f1036785 (patch) | |
tree | 9ab0140ffc0ec073c1ece2d948afffb82e53a079 /src/polkitagent | |
parent | 8fb8b406bab50c5ef8c5d4f743e3f13924bd5f73 (diff) | |
download | polkit-4aa6dd28476e12a5265d71b6bc19c730f1036785.tar.gz |
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@redhat.com>
Diffstat (limited to 'src/polkitagent')
-rw-r--r-- | 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: |