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

[PATCH 2/3] diff.c: plug a memory leak in an error path

From
Johannes Sixt <j6t@kdbg.org>
Date
Jun 8, 2009, 20:34 UTC
Message-ID
<8f487369337bdb1c9884b8f6e56530d25de85472.1244492659.git.j6t@kdbg.org>
In-Reply-To
<e4b190906055eb86077ca3e7257c983befcfb511.1244492659.git.j6t@kdbg.org>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 diff.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/diff.c b/diff.c
index 4d0a5b9..43835d7 100644
--- a/diff.c
+++ b/diff.c
@@ -3596,6 +3596,7 @@ 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) {
+		strbuf_release(&buf);
 		remove_tempfile();
 		error("error running textconv command '%s'", pgm);
 		return NULL;
-- 
1.6.3.17.g1665f
Previous: Johannes SixtNext: Johannes Sixt
Message 3 of 4 in “Miscellanous cleanups around start_command/run_command callers”
  1. 0/3 Miscellanous cleanups around start_command/run_command callersJohannes Sixt, Jun 8, 2009
  2. 1/3 Simplify some instances of run_command() by using run_command_v_opt().Johannes Sixt, Jun 8, 2009
  3. 2/3 diff.c: plug a memory leak in an error pathJohannes Sixt, Jun 8, 2009
  4. 3/3 Simplify some 'fprintf(stderr); return -1;' by using 'return error()'Johannes Sixt, Jun 8, 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.