{"thread":{"id":"34434","subject":"[PATCH] commit: Fix a memory leak in determine_author_info","startedAt":"2013-07-14T14:01:03Z","lastAt":"2013-07-15T14:46:38Z","messageCount":3,"participants":["Stefan Beller","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"223324","messageId":"1373810463-7144-1-git-send-email-stefanbeller@googlemail.com","threadId":"34434","inReplyTo":null,"subject":"[PATCH] commit: Fix a memory leak in determine_author_info","fromName":"Stefan Beller","fromEmail":"stefanbeller@googlemail.com","sentAt":"2013-07-14T14:01:03Z","receivedAt":"2013-07-14T14:01:03Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"The date variable is assigned new memory via xmemdupz and 2 lines later\nit is assigned new memory again via xmalloc, but the first assignment\nis never freed nor used.\n---\n builtin/commit.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 790e5ab..00da83c 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -534,7 +534,6 @@ static void determine_author_info(struct strbuf *author_ident)\n \t\t\t\t\t(lb - strlen(\" \") -\n \t\t\t\t\t (a + strlen(\"\\nauthor \"))));\n \t\temail = xmemdupz(lb + strlen(\"<\"), rb - (lb + strlen(\"<\")));\n-\t\tdate = xmemdupz(rb + strlen(\"> \"), eol - (rb + strlen(\"> \")));\n \t\tlen = eol - (rb + strlen(\"> \"));\n \t\tdate = xmalloc(len + 2);\n \t\t*date = '@';\n-- \n1.8.3.2.806.gdee5b9b\n"},{"id":"223431","messageId":"7vehazevf3.fsf@alter.siamese.dyndns.org","threadId":"34434","inReplyTo":"1373810463-7144-1-git-send-email-stefanbeller@googlemail.com","subject":"Re: [PATCH] commit: Fix a memory leak in determine_author_info","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-15T14:42:56Z","receivedAt":"2013-07-15T14:42:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <stefanbeller@googlemail.com> writes:\n\n> The date variable is assigned new memory via xmemdupz and 2 lines later\n> it is assigned new memory again via xmalloc, but the first assignment\n> is never freed nor used.\n> ---\n>  builtin/commit.c | 1 -\n>  1 file changed, 1 deletion(-)\n>\n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index 790e5ab..00da83c 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -534,7 +534,6 @@ static void determine_author_info(struct strbuf *author_ident)\n>  \t\t\t\t\t(lb - strlen(\" \") -\n>  \t\t\t\t\t (a + strlen(\"\\nauthor \"))));\n>  \t\temail = xmemdupz(lb + strlen(\"<\"), rb - (lb + strlen(\"<\")));\n> -\t\tdate = xmemdupz(rb + strlen(\"> \"), eol - (rb + strlen(\"> \")));\n>  \t\tlen = eol - (rb + strlen(\"> \"));\n>  \t\tdate = xmalloc(len + 2);\n>  \t\t*date = '@';\n\nMakes sense. I'd assume this is signed-off?\n"},{"id":"223432","messageId":"51E40B4E.7040309@googlemail.com","threadId":"34434","inReplyTo":"7vehazevf3.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] commit: Fix a memory leak in determine_author_info","fromName":"Stefan Beller","fromEmail":"stefanbeller@googlemail.com","sentAt":"2013-07-15T14:46:38Z","receivedAt":"2013-07-15T14:46:38Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On 07/15/2013 04:42 PM, Junio C Hamano wrote:\n> Stefan Beller <stefanbeller@googlemail.com> writes:\n> \n>> The date variable is assigned new memory via xmemdupz and 2 lines later\n>> it is assigned new memory again via xmalloc, but the first assignment\n>> is never freed nor used.\n>> ---\n>>  builtin/commit.c | 1 -\n>>  1 file changed, 1 deletion(-)\n>>\n>> diff --git a/builtin/commit.c b/builtin/commit.c\n>> index 790e5ab..00da83c 100644\n>> --- a/builtin/commit.c\n>> +++ b/builtin/commit.c\n>> @@ -534,7 +534,6 @@ static void determine_author_info(struct strbuf *author_ident)\n>>  \t\t\t\t\t(lb - strlen(\" \") -\n>>  \t\t\t\t\t (a + strlen(\"\\nauthor \"))));\n>>  \t\temail = xmemdupz(lb + strlen(\"<\"), rb - (lb + strlen(\"<\")));\n>> -\t\tdate = xmemdupz(rb + strlen(\"> \"), eol - (rb + strlen(\"> \")));\n>>  \t\tlen = eol - (rb + strlen(\"> \"));\n>>  \t\tdate = xmalloc(len + 2);\n>>  \t\t*date = '@';\n> \n> Makes sense. I'd assume this is signed-off?\n> \n\nAs I realised I did not sign it,\nI resend it with some other findings a few hours later,\nso you'll find it there as well.\n\nSee Message-ID\n<1373837749-14402-2-git-send-email-stefanbeller@googlemail.com>\n[PATCH 2/4] commit: Fix a memory leak in determine_author_info\n"}]}