actually close the fds

This commit is contained in:
randomuser 2022-01-07 15:45:58 -06:00
parent dc2969a5f8
commit 44a0d2a9d3
1 changed files with 4 additions and 2 deletions

View File

@ -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));
return buf;
}
close(pfds[0]);
close(pfds[1]);
return buf;
}
}
}