[vte] Don't leak a FD when starting the PTY helper fails



commit bd66b79ef8395e9ffe177e82aff20bf5de6f79e5
Author: Christian Persch <chpe gnome org>
Date:   Wed Mar 24 21:26:23 2010 +0100

    Don't leak a FD when starting the PTY helper fails

 src/pty.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/pty.c b/src/pty.c
index 954d82e..7ca34d1 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -1112,7 +1112,8 @@ _vte_pty_stop_helper(void)
 static gboolean
 _vte_pty_start_helper(GError **error)
 {
-	int i, tunnel;
+	int i;
+        int tunnel = -1;
         int tmp[2] = { -1, -1 };
 
         if (_vte_pty_helper_started)
@@ -1183,6 +1184,11 @@ failure:
                 close(tmp[0]);
         if (tmp[1] != -1)
                 close(tmp[1]);
+        if (tunnel != -1)
+                close(tunnel);
+
+        _vte_pty_helper_pid = -1;
+        _vte_pty_helper_tunnel = -1;
 
         return FALSE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]