Re: [PATCH v4 12/27] object-file: mark cached object buffers as const
On Wed, Jun 05, 2024 at 11:10:20PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
> >> + co_buf = xmalloc(len);
> >> + memcpy(co_buf, buf, len);
> >>
> >> hash_object_file(the_hash_algo, buf, len, type, oid);
> >> if (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
> >
> > There is an early return around here. Perhaps we are leaking co_buf
> > when we hit it?
>
> Indeed, that seems to be the case. With the attached at the tip of
> the branch and rebuilding 'seen' seems to pass these 6130, 7010, 8002
> tests with SANTIZE=leak.
Indeed, thanks. Rolled into my local version now.
Patrick