summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-08-27 07:56:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-08-27 17:30:42 (GMT)
commit6876618ceaafddba625ed823679d99de0e79d111 (patch)
treeb88b9e758dc287b1bef3ae0fc6ea61a6546314f9 /commit.c
parentfe6eb7f2c506190c817407accf27834005a57f2b (diff)
downloadgit-6876618ceaafddba625ed823679d99de0e79d111.zip
git-6876618ceaafddba625ed823679d99de0e79d111.tar.gz
git-6876618ceaafddba625ed823679d99de0e79d111.tar.bz2
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index b6ffd62..4ff8c66 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,