Re: [PATCH v4 3/8] object-store: add function to free object_info contents
- From
Calvin Wan <calvinwan@google.com>
- Date
- May 5, 2022, 16:47 UTC
- Message-ID
- <CAFySSZB72GTaJRvoGXgfkBE3w6+pYz9QVpGgEcsxy_8EDG-xpg@mail.gmail.com>
- In-Reply-To
- <xmqqv8ukkf6o.fsf@gitster.g>
Apologies for the mistakes. Getting a script from Josh Steadmon to make sure these things never happen again :)
On Wed, May 4, 2022 at 5:15 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 37 quoted lines
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> >> + 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().
>
> > 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.