[Haiku-commits] r21903 - haiku/trunk/src/system/libroot/posix/malloc

Michael Lotz mmlr at mlotz.ch
Sun Aug 12 18:26:27 CEST 2007


Hi Ingo

> realloc() must not free() the supplied pointer if it fails to 
> allocate 
> memory. And yes, errno must be set to ENOMEM (same holds for 
> malloc()).

Yeah, obviously it must not free the old buffer as otherwise you're 
left with nothing ;-)
Changed that and also added the errno setting to all of the allocation 
functions. I checked with the specs and this should be correct, 
although I am not sure about memalign. It's noted that memalign is 
obsolete and replaced by posix_memalign, but for now I think this 
should work.

Regards
Michael



More information about the Haiku-commits mailing list