-lmalloc

Mike Thompson mike at iotek.UUCP
Thu Feb 2 00:06:42 AEST 1989


In article <3724 at ingr.com> dan at ingr.com (Dan Webb) writes in reply to 
	article <4143 at pt.cs.cmu.edu>, scotts at isl1.ri.cmu.edu (Scott Safier):
>I've had the same problem with -lmalloc (also known as malloc(3X)).
>The crashes are probably caused by the fact that this implementation of
>malloc, for some reason, treats a request for zero bytes as invalid.
>It therefore returns a NULL pointer, which is probably passed to free()
>or realloc() later, resulting in a core dump.
>
>I probably don't have to convince too many people of this, but a request
>for zero bytes is by no means an invalid request.  I think -lmalloc should
>be fixed.
>
>	 - Dan Webb

	Well I'm one of those few who need convincing, I think that
    treating a request for 0 memory from a memory managment system as
    an error is if not correct is at least not incorrect, to give you
    a valid pointer would in effect be allocating at least a byte,
    after all that address cannot be allocated to any other request
    can it?  On the other hand a program that does not check for
    errors on system calls, and does no checking for null pointers is
    definitely what I would call not written in the best of styles if
    not down right buggy!  (especially with the problems of null
    de-referencing effecting portability over the past few years)
-- 
<<<<<<******>>>>>>
Michael A. Thompson, Iotek Inc, |*| E-Mail: mike at iotek.uucp	|*| Have
1127 Barrington St., Suite 100, |*| Fax:    (902)420-0674	|*|   a Good
Halifax, N.S., B3H 2P8, Canada  |*| Phone:  (902)420-1890	|*|     Day :-)



More information about the Comp.sys.sgi mailing list