On Wed, Nov 26, 2014 at 7:24 PM, Jonathan Nieder <[email protected]> wrote:
> Alexander Kuleshov wrote:
> [...]
>> +++ b/builtin/cat-file.c
>> @@ -68,9 +69,14 @@ static int cat_one_file(int opt, const char
>> +        buf_must_free = 1;
>> +
>> -        if (!buf)
>> +        if (!buf) {
>> +            free(buf);
>>              die("Cannot read object %s", obj_name);
>
> Is this free() needed?  The program die()s right afterward, which
> would free all memory automatically as part of exiting.  Tools like
> valgrind would understand that nothing is wrong since buf is still
> reachable through the stack.

Moreover, 'buf' can only be NULL inside the conditional, so the free()
is pointless.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to