From 44a0d2a9d3ba5bff1ca86fadb13e64d0153ba0e1 Mon Sep 17 00:00:00 2001 From: randomuser Date: Fri, 7 Jan 2022 15:45:58 -0600 Subject: [PATCH] actually close the fds --- c/simplestatus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/c/simplestatus.c b/c/simplestatus.c index 7e00d02..9866bd8 100644 --- a/c/simplestatus.c +++ b/c/simplestatus.c @@ -107,6 +107,8 @@ char *execstdout(char *file, char *arg[], char *env[]) { continue; } else { free(buf); + close(pfds[0]); + close(pfds[1]); return NULL; } } @@ -125,10 +127,10 @@ char *execstdout(char *file, char *arg[], char *env[]) { buf[total] = '\0'; buf = realloc(buf, strlen(buf)); + close(pfds[0]); + close(pfds[1]); return buf; } - close(pfds[0]); - close(pfds[1]); } }