[Bug 1730] Change malloc(0) behavior to match FreeBSD and Linux
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Mon Jan 31 20:50:21 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1730
--- Comment #13 from Gedare <giddyup44 at yahoo.com> 2011-01-31 14:50:18 CST ---
Interestingly, I ran into code today that failed because of this behavior. The
code uses lists allocated within a struct, and allocates a list of size 0 in
case the list is unused by the struct. 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.
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list