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

[PATCH 2/2] apply: free patch->result

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2012, 22:21 UTC
Message-ID
<7vwr6dzjbn.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<7v1uol1tud.fsf_-_@alter.siamese.dyndns.org>

This is by far the largest piece of data, much larger than the patch and fragment structures or the three name fields in the patch structure.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
I have not finished auditing all the codepaths, so this change needs to be
eyeballed carefully. We may be pointing an unfreeable piece of memory or a
piece of memory that belong to other structures that are going to be freed
otherwise.
 builtin/apply.c |    1 +
 1 file changed, 1 insertion(+)
diff --git a/builtin/apply.c b/builtin/apply.c
index 5d03e50..c919db3 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -212,6 +212,7 @@ static void free_patch(struct patch *patch)
 		free(patch->def_name);
 		free(patch->old_name);
 		free(patch->new_name);
+		free(patch->result);
 		free(patch);
 		patch = patch_next;
 	}
-- 
1.7.10.rc1.76.g1a8310
Previous: Junio C HamanoNext: Jared Hance
Message 5 of 9 in “Fix documented fixme's throughout”
  1. 0/3 Fix documented fixme's throughoutJared Hance, Mar 7, 2012
  2. 1/3 Fix memory leak in apply_patch in apply.c.Jared Hance, Mar 7, 2012
  3. Junio C HamanoMar 7, 2012
  4. 1/2 apply: free patch->{def,old,new}_name fieldsJunio C Hamano, Mar 21, 2012
  5. 2/2 apply: free patch->resultJunio C Hamano, Mar 21, 2012
  6. 2/3 Add threaded versions of functions in symlinks.c.Jared Hance, Mar 7, 2012
  7. Junio C HamanoMar 7, 2012
  8. 3/3 Use startup_info->prefix rather than prefix.Jared Hance, Mar 7, 2012
  9. Junio C HamanoMar 7, 2012

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.