realloc reactions ??

Vernon Schryver vjs at rhyolite.wpd.sgi.com
Tue Feb 19 06:50:55 AEST 1991


>                     Why does SGI's realloc() barf on
> a null pointer....


There is a brand of solar workstation with a free() that does not care what
it's arg is.  You can free() automatic variables, because their version
first tries to validate the pointer, and ignores what looks wrong.  The
code written by that engineering organization is--let's be polite--care free
about malloc/free/realloc args.

Some of us consider that practice less than fastidious, and while not
strictly wrong, similar to using int's as pointers.  For years we have been
painfully aware of such solar code, including kernel code.

Being careful to always pass good things to free & relloc makes correct
code bigger, but also makes incorrect code fail sooner.  The hard malloc
bugs are the ones whose corruption causes disaster 10e10 cycles later.


Vernon  Schryver,  vjs at sgi.com



More information about the Comp.sys.sgi mailing list