Subject: Re: bug#75551: Potentially erroneous long loop in lrealloc

From: Hong Xu <[email-masked]>
Date: Fri, 17 Jan 2025 13:05:36 -0800

On Thu 2025/01/16 23:37:29-0800 (PST), Paul Eggert wrote:
> On 2025-01-16 13:46, Hong Xu wrote:
>> After applying the patch to the master branch, I'm getting a memory
>> exhaustion error when starting Emacs:
> 
> Oh, I was assuming sane malloc/realloc behavior and you tested on a platform which doesn't do that. Gnulib fixes that and I thought Emacs was already using Gnulib for this, but I now see that Emacs uses Gnulib to fix only malloc, not realloc.
> 
> Please try the attached two patches instead. The first one arranges for Emacs to also fix realloc. The second one is the same patch that I gave you earlier, the patch that simplifies the lrealloc code.
> 
> The MS-Windows port already fixes malloc and realloc in a different way, so the first patch should affect only non-MS-Windows platforms.

Thanks, the patch looks good to me and works well on my host!