Skip to content

Commit

Permalink
textconv: stop leaking file descriptors
Browse files Browse the repository at this point in the history
We read the output from textconv helpers over a pipe, but we
never actually closed our end of the pipe after using it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Dec 30, 2009
1 parent 799fdb4 commit 70d7099
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3485,11 +3485,13 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
if (start_command(&child) != 0 ||
strbuf_read(&buf, child.out, 0) < 0 ||
finish_command(&child) != 0) {
close(child.out);
if (temp.name == temp.tmp_path)
unlink(temp.name);
error("error running textconv command '%s'", pgm);
return NULL;
}
close(child.out);
if (temp.name == temp.tmp_path)
unlink(temp.name);

Expand Down

0 comments on commit 70d7099

Please sign in to comment.