commit: Fix a memory leak in determine_author_info
authorStefan Beller <stefanbeller@googlemail.com>
Sun, 14 Jul 2013 21:35:47 +0000 (23:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jul 2013 16:45:21 +0000 (09:45 -0700)
The date variable is assigned new memory via xmemdupz and 2 lines later
it is assigned new memory again via xmalloc, but the first assignment
is never freed nor used.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c

index d21d07a..0575ad8 100644 (file)
@@ -526,7 +526,6 @@ static void determine_author_info(struct strbuf *author_ident)
                                        (lb - strlen(" ") -
                                         (a + strlen("\nauthor "))));
                email = xmemdupz(lb + strlen("<"), rb - (lb + strlen("<")));
-               date = xmemdupz(rb + strlen("> "), eol - (rb + strlen("> ")));
                len = eol - (rb + strlen("> "));
                date = xmalloc(len + 2);
                *date = '@';