From 127b9e11a18f94561c9fcd3876ea5156128b46df Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 8 Mar 2006 11:57:41 -0500
Subject: [PATCH] BUG: Do not leak ps FILE when the process starts but reading
 the header fails.

---
 ProcessUNIX.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ProcessUNIX.c b/ProcessUNIX.c
index d9e6691..b93e0e6 100644
--- a/ProcessUNIX.c
+++ b/ProcessUNIX.c
@@ -1997,8 +1997,11 @@ static void kwsysProcessKill(pid_t process_id)
           kwsysProcessKill(pid);
           }
         }
+      }
 
-      /* We are done with the ps process.  */
+    /* We are done with the ps process.  */
+    if(ps)
+      {
       pclose(ps);
       }
     }
-- 
GitLab