Subject: Re: bug#9273: 23.3; malloc initialization should (sometimes) happen at runtime

From: Eli Zaretskii <[email-masked]>
Date: Fri, 12 Aug 2011 14:33:13 +0300

> Date: Fri, 12 Aug 2011 06:10:35 -0400
> From: Ken Brown <[email-masked]>
> CC: "[email-masked]" <[email-masked]>
> 
> On 8/12/2011 2:54 AM, Eli Zaretskii wrote:
> >> Date: Thu, 11 Aug 2011 17:45:41 -0400
> >> From: Ken Brown<[email-masked]>
> >> CC: "[email-masked]"<[email-masked]>
> >>
> >> The problem was that realloc got called on memory that had been
> >> allocated prior to dumping, and the malloc information that was used
> >> then had disappeared.
> >
> > Can you show the code which called realloc on that memory?  I'm
> > surprised that Emacs does that, but perhaps I'm missing something.
> 
> Here's the code that I stumbled across (as a result of a SEGV).  I 
> haven't checked to see if there are other examples.  From terminal.c:
> 
> /* Deletes the bootstrap terminal device.
>     Called through delete_terminal_hook. */
> 
> static void
> delete_initial_terminal (struct terminal *terminal)
> {
>    if (terminal != initial_terminal)
>      abort ();
> 
>    delete_terminal (terminal);
>    initial_terminal = NULL;
> }

delete_terminal doesn't call realloc, it just calls xfree.

Do the problems with the Cygwin build go away if the call to
delete_terminal is commented out?  That is, does the infloop still
happen or not?