Skip to content

Commit 6356e34

Browse files
N-R-Kvapier
authored andcommitted
pipes: don't leak pipes on fork error
1 parent 90b7999 commit 6356e34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/shared/pipes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ int rc_pipe_command(char *cmd)
5151
}
5252
execl("/bin/sh", "sh", "-c", cmd, NULL);
5353
exit(1);
54+
} else {
55+
/* error */
56+
close(pfd[pipe_read_end]);
57+
close(pfd[pipe_write_end]);
5458
}
5559
return -1;
5660
}

0 commit comments

Comments
 (0)