From 13e02b76133a1c9619516e604277fa7e0417894c Mon Sep 17 00:00:00 2001
From: Matthias Maennich <matthias@maennich.net>
Date: Thu, 5 Oct 2017 13:53:07 +0200
Subject: [PATCH] processUNIX: close intermediate file descriptor in error case

---
 ProcessUNIX.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ProcessUNIX.c b/ProcessUNIX.c
index 3b32ca7..958c9d3 100644
--- a/ProcessUNIX.c
+++ b/ProcessUNIX.c
@@ -1938,6 +1938,7 @@ static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
 
   /* Set close-on-exec flag on the pipe's end.  */
   if (fcntl(fout, F_SETFD, FD_CLOEXEC) < 0) {
+    close(fout);
     return 0;
   }
 
-- 
GitLab