Fgets and malloc_verify()

Richard Doherty emperor!sugar!richd at uunet.uu.net
Thu Feb 14 09:03:00 AEST 1991


It appears that malloc_debug() believes that fgets() makes a call to
malloc() with size of 0.  This in itself is alright, except that
malloc_debug() (and therfore malloc_verify()) abort as soon as they
discover this, making them useless for further debugging.

Details:

OS4.0.1 Sun4 (Sparc)

When NOT linked with /usr/lib/debug/malloc.o, fgets() does not display
this behavior -- determined by writing another malloc routine local to the
routine, and checking for size of 0.

Malloc_verify() called anytime after the call to fgets() reports that the
heap is corrupt (having a block size of 0 for one entry) and aborts.

This may indeed simply be a much more obscure memory problem in my program
itself.

It makes malloc_verify() useless (although, admittedly, I have never found
it all that useful in the first place).

--Rich



More information about the Comp.sys.sun mailing list