[Bug 1730] Change malloc(0) behavior to match FreeBSD and Linux
Peter Dufault
dufault at hda.com
Mon Jan 31 22:05:37 UTC 2011
On Jan 31, 2011, at 3:50 , bugzilla-daemon at rtems.org wrote:
> The check for NULL return value for
> out-of-memory was tripped by malloc(0), so the program spuriously exited. I
> had to add a check to say that I wanted to use malloc(0)'s results, and another
> check when free'ing to avoid passing NULL.
By definition you can pass NULL to free() and realloc() and they will do the right thing, so the second check isn't needed. I'm not sure what you mean by "you had to add a check to say that I wanted to use malloc(0)'s results" - can you clarify?
Peter
-----------------
Peter Dufault
HD Associates, Inc. Software and System Engineering
More information about the bugs
mailing list