Re: [PATCH] builtin/log.c: fix minor memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> Matthieu Moy wrote:
>
>> Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx>
>> ---
>> Valgrind confirms, one less unreachable block ;-).
>
> This belongs in the commit message.
>
> [...]
>> --- a/builtin/log.c
>> +++ b/builtin/log.c
>> @@ -857,20 +857,21 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
>>  {
>>  	struct strbuf desc = STRBUF_INIT;
>>  	if (!branch_name || !*branch_name)
>>  		return;
>>  	read_branch_desc(&desc, branch_name);
>>  	if (desc.len) {
>>  		strbuf_addch(buf, '\n');
>>  		strbuf_addbuf(buf, &desc);
>>  		strbuf_addch(buf, '\n');
>>  	}
>> +	strbuf_release(&desc);
>
> This is an old one.  The leak was introduced by v1.7.9-rc1~1^2~12
> (format-patch: use branch description in cover letter, 2011-09-21).
>
> I was a little scared to see a leak in 'git log' code, since most of
> what log does involves looping over many commits.  Luckily this one is
> only used in make_cover_letter to create a cover letter describing the
> single branch on the command line, making it is a small, one-time
> leak.

Exactly ;-).

>
> Less noise from static and dynamic analysis tools is still worthwhile,
> so for what it's worth,
>
> Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
>
> Thanks.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]