[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NULL call to _Workspace_Free() via _Objects_Extend_information at startup



On Mar 1, 2011, at 3:56 , Sebastian Huber wrote:

>> I'm not sure the requirement that "_Heap_Free(heap, NULL)" be ignored makes much sense.
> 
> It makes sense in a way that _Heap_Free() accepts in this case all values
> returned by _Heap_Allocate_*().

Hmm.  By that you mean it handles a failure return where _Heap_Allocate_*() couldn't allocate memory or was passed bogus arguments, and the caller didn't check the return code and handle it appropriately?  I don't see the advantage of that.

In the malloc() / free() / realloc() case I've always assumed the NULL pointer requirement is so that you can initialize an array of pointers to zero and then use realloc() and free() on them without special testing, not so that you can pass the returned value of a failed malloc() to free().

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering