Subject: Re: [PATCH 0/4] reftable: fix out-of-memory errors on NonStop

From: Junio C Hamano <[email-masked]>
Date: Sat, 21 Dec 2024 09:43:33 -0800

Randall Becker <[email-masked]> writes:

> Thank you for this series. I think the problem may not be limited
> only to NonStop based on the documented ambiguous behaviour of
> malloc.

Yes, an implementation is allowed to return NULL when asked to
allocate 0 bytes.  On the Git side, we sidestep the problem in
exactly the opposite way---our malloc() wrapper makes another
request to allocate 1-byte block after seeing NULL from a request
for 0-byte allocation.  The reftable code takes an approach to
eliminate the need to requiest 0-sized allocation in the first
place, which is an arguably more valid solution.

Thanks, both, for finding and fixing the issue.