git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ramkumar Ramachandra" <artagnon@gmail.com>,
	"Pete Wyckoff" <pw@padd.com>,
	git@vger.kernel.org, "Nguyễn Thái Ngọc" <pclouds@gmail.com>
Subject: Re: leaky cherry-pick
Date: Wed, 11 Jan 2012 22:05:03 -0500	[thread overview]
Message-ID: <20120112030503.GA26363@sigill.intra.peff.net> (raw)
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

      reply	other threads:[~2012-01-12  3:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 22:37 leaky cherry-pick Pete Wyckoff
2012-01-09 23:19 ` Junio C Hamano
2012-01-10  1:38 ` Nguyen Thai Ngoc Duy
2012-01-10  5:28 ` Ramkumar Ramachandra
2012-01-10 19:50   ` Jeff King
2012-01-11  3:30     ` Ramkumar Ramachandra
2012-01-11  8:16       ` Junio C Hamano
2012-01-11  9:00         ` Ramkumar Ramachandra
2012-01-11 19:56           ` Jeff King
2012-01-12  0:00             ` Junio C Hamano
2012-01-12  3:05               ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120112030503.GA26363@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).