git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH] builtin/log.c: fix minor memory leak
Date: Thu,  7 Aug 2014 19:13:37 +0200	[thread overview]
Message-ID: <1407431617-4156-1-git-send-email-Matthieu.Moy@imag.fr> (raw)

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Valgrind confirms, one less unreachable block ;-).

 builtin/log.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/log.c b/builtin/log.c
index 4389722..e4d8122 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -857,20 +857,21 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
 {
 	struct strbuf desc = STRBUF_INIT;
 	if (!branch_name || !*branch_name)
 		return;
 	read_branch_desc(&desc, branch_name);
 	if (desc.len) {
 		strbuf_addch(buf, '\n');
 		strbuf_addbuf(buf, &desc);
 		strbuf_addch(buf, '\n');
 	}
+	strbuf_release(&desc);
 }
 
 static char *find_branch_name(struct rev_info *rev)
 {
 	int i, positive = -1;
 	unsigned char branch_sha1[20];
 	const unsigned char *tip_sha1;
 	const char *ref, *v;
 	char *full_ref, *branch = NULL;
 
-- 
2.0.2.737.gfb43bde

             reply	other threads:[~2014-08-07 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 17:13 Matthieu Moy [this message]
2014-08-07 18:04 ` [PATCH] builtin/log.c: fix minor memory leak Jonathan Nieder
2014-08-07 19:28   ` Junio C Hamano

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=1407431617-4156-1-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).