git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] textconv: stop leaking file descriptors

From
Jeff King <peff@peff.net>
Date
Dec 30, 2009, 09:02 UTC
Message-ID
<20091230090253.GA24049@coredump.intra.peff.net>

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>
---
This should go onto 'maint'. Now I'll just go find a brown paper bag...
 diff.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/diff.c b/diff.c
index d14a575..aad4b39 100644
--- a/diff.c
+++ b/diff.c
@@ -3823,11 +3823,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);
 		strbuf_release(&buf);
 		remove_tempfile();
 		error("error running textconv command '%s'", pgm);
 		return NULL;
 	}
+	close(child.out);
 	remove_tempfile();
 
 	return strbuf_detach(&buf, outsize);
-- 
1.6.6.320.g7c9b3
Message 1 of 1 in “textconv: stop leaking file descriptors”
  1. textconv: stop leaking file descriptorsJeff King, Dec 30, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.