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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 27, 2014 at 03:56 UTC 6876618ceaafddba625ed823679d99de0e79d111
1 file changed +1 -1
commit.c
+1 -1
@@ -594,7 +594,7 @@ static void record_author_date(struct author_date_slab *author_date,
594 line_end = strchrnul(buf, '\n');
595 if (!skip_prefix(buf, "author ", &ident_line)) {
596 if (!line_end[0] || line_end[1] == '\n')
597 - return; /* end of header */
597 + goto fail_exit; /* end of header */
598 continue;
599 }
600 if (split_ident_line(&ident,