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

Re: leaky cherry-pick

From
Jeff King <peff@peff.net>
Date
Jan 12, 2012, 03:05 UTC
Message-ID
<20120112030503.GA26363@sigill.intra.peff.net>
In-Reply-To
<7v7h0x6b89.fsf@alter.siamese.dyndns.org>
On Wed, Jan 11, 2012 at 04:00:38PM -0800, Junio C Hamano wrote:
> Yeah, that is definitely a leak.

Here it is with a commit message. "valgrind git cherry-pick" reports no leaks in the attr code after this (but unfortunately still lots of leaks from unpack-trees).

-Peff
-- >8 --
Subject: [PATCH] attr: fix leak in free_attr_elem

This function frees the individual "struct match_attr"s we have allocated, but forgot to free the array holding their pointers, leading to a very minor memory leak.

Signed-off-by: Jeff King <peff@peff.net>
---
 attr.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/attr.c b/attr.c
index 96eda0e..303751f 100644
--- a/attr.c
+++ b/attr.c
@@ -301,6 +301,7 @@ static void free_attr_elem(struct attr_stack *e)
 		}
 		free(a);
 	}
+	free(e->attrs);
 	free(e);
 }
 
-- 
1.7.9.rc0.33.gd3c17
Previous: Junio C Hamano
Message 11 of 11 in “leaky cherry-pick”
  1. Pete WyckoffJan 9, 2012
  2. Junio C HamanoJan 9, 2012
  3. Nguyen Thai Ngoc DuyJan 10, 2012
  4. Ramkumar RamachandraJan 10, 2012
  5. Jeff KingJan 10, 2012
  6. Ramkumar RamachandraJan 11, 2012
  7. Junio C HamanoJan 11, 2012
  8. Ramkumar RamachandraJan 11, 2012
  9. Jeff KingJan 11, 2012
  10. Junio C HamanoJan 12, 2012
  11. Jeff KingJan 12, 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.