git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fmt-merge-msg: plug small leak of commit buffer
@ 2015-04-15 21:25 Junio C Hamano
  2015-04-15 21:30 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2015-04-15 21:25 UTC (permalink / raw)
  To: git; +Cc: Jeff King

A broken or badly formatted commit might not record author or
committer lines; the function record_person() returned after
calling get_commit_buffer() without calling unuse_commit_buffer()
on the memory, potentially leaking it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * to be applied on bc6b8fc1 (use get_commit_buffer everywhere,
   2014-06-10)

 builtin/fmt-merge-msg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 01f6d59..076264d 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -238,8 +238,10 @@ static void record_person(int which, struct string_list *people,
 	field = (which == 'a') ? "\nauthor " : "\ncommitter ";
 	buffer = get_commit_buffer(commit);
 	name = strstr(buffer, field);
-	if (!name)
+	if (!name) {
+		unuse_commit_buffer(commit, buffer);
 		return;
+	}
 	name += strlen(field);
 	name_end = strchrnul(name, '<');
 	if (*name_end)
-- 
2.4.0-rc2-173-gefc434b

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-20 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15 21:25 [PATCH] fmt-merge-msg: plug small leak of commit buffer Junio C Hamano
2015-04-15 21:30 ` Junio C Hamano
2015-04-15 22:14   ` Jeff King
2015-04-20 21:35     ` Junio C Hamano

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).