Fix for truly nasty bug introduced this morning

Eric S. Raymond esr at thyrsus.com
Tue Aug 15 22:08:12 UTC 2017


Hal Murray <hmurray at megapathdsl.net>:
> 
> > The mistake I made was putting the new field first in the structure. This
> > caused it to be randomly trashed by type-punning dynamic-allocation code
> > that was expecting a link field there. 
> 
> I don't understand yet.  Why are we type punning there?  If it's a hack to 
> avoid malloc, why is the caller assuming anything about the state of the new 
> storage?
> 
> Should we make a cleanup pass at all avoid-malloc hacks?

Oh dear Goddess, not *now*.  That would be extremely risky.

I think it's not hack to avoid malloc, but rather a hack to allow the config
tree to consist of variable-sized structure nodes that are all chain-linked in
such a way that they can be freed after config parsing with a simple
traverse of that list.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

Please consider contributing to my Patreon page at https://www.patreon.com/esr
so I can keep the invisible wheels of the Internet turning. Give generously -
the civilization you save might be your own.



More information about the devel mailing list