From 6876618ceaafddba625ed823679d99de0e79d111 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 27 Aug 2014 03:56:31 -0400 Subject: record_author_date(): fix memory leak on malformed commit If we hit the end-of-header without finding an "author" line, we just return from the function. We should jump to the fail_exit path to clean up the buffer that we may have allocated. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit.c') diff --git a/commit.c b/commit.c index b6ffd623c8..4ff8c66f96 100644 --- a/commit.c +++ b/commit.c @@ -594,7 +594,7 @@ static void record_author_date(struct author_date_slab *author_date, line_end = strchrnul(buf, '\n'); if (!skip_prefix(buf, "author ", &ident_line)) { if (!line_end[0] || line_end[1] == '\n') - return; /* end of header */ + goto fail_exit; /* end of header */ continue; } if (split_ident_line(&ident, -- cgit v1.2.1