Re: [PATCH v4 3/8] object-store: add function to free object_info contents
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 5, 2022, 00:15 UTC
- Message-ID
- <xmqqv8ukkf6o.fsf@gitster.g>
- In-Reply-To
- <xmqqzgjztt7s.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 20 quoted lines
>> + if (object_info->typep) >> + free(object_info->typep); >> + if (object_info->sizep) >> + free(object_info->sizep); >> + if (object_info->disk_sizep) >> + free(object_info->disk_sizep); >> + if (object_info->delta_base_oid) >> + free(object_info->delta_base_oid); >> + if (object_info->type_name) >> + free(object_info->type_name); > > if (PTR) > free(PTR); > > can and should be written as > > free(PTR); > > If we are reusing object_info after calling this function, we > _might_ want to use FREE_AND_NULL() instead of free().
Show 6 quoted lines
> As this breaks my build cycle ("make sparse" is part of my
> post-integration check), I have added this workaround on the tip of
> the topic, but please make sure I do not have to redo that when you
> reroll.
>
> Thanks.Again, this breaks the build at GitHub CI (static-analysis), I added this workaround on the tip of the topic, merged it to 'seen' and pushed the result out, but please make sure I do not have to redo that when you reroll.
Thanks.