Re: [PATCH v7 01/11] dir: free untracked cache when removing it

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

 



On Mon, Jan 25, 2016 at 8:16 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> On Sun, Jan 24, 2016 at 7:28 AM, Christian Couder
> <christian.couder@xxxxxxxxx> wrote:
>> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
>> ---
>>  builtin/update-index.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/builtin/update-index.c b/builtin/update-index.c
>> index 7431938..a6fff87 100644
>> --- a/builtin/update-index.c
>> +++ b/builtin/update-index.c
>> @@ -1123,6 +1123,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>>                 add_untracked_ident(the_index.untracked);
>>                 the_index.cache_changed |= UNTRACKED_CHANGED;
>>         } else if (!untracked_cache && the_index.untracked) {
>> +               free_untracked_cache(the_index.untracked);
>
> Do we need to free its members, too? (Or is it empty enough here,
> that there are no memleaks in there? If this were the case a hint in
> the commit message would be helpful)

free_untracked_cache() takes care of freeing the members of the struct
it is passed. If it doesn't free them all it's probably a bug. Many
free_*() functions in the Git code base do the same thing. And yeah I
think it is safer to free everything.
--
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]