NULL call to _Workspace_Free() via _Objects_Extend_information at startup
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Mar 1 08:19:20 UTC 2011
On 03/01/2011 09:05 AM, Peter Dufault wrote:
>
> On Mar 1, 2011, at 2:44 , Sebastian Huber wrote:
>
>> do you experience this behavior with the debug variant of RTEMS or with the
>> normal configuration?
> Debugging enabled.
>>
>> A call to _Heap_Free(NULL) must return true.
>
> You mean a call to _Heap_Free(heap_control, NULL) must return true. Fine, someone must update the interface documentation to add that requirement.
>
> Just to be a trouble-maker, what should these functions return given a NULL heap block pointer? Currently it is unspecified.
Yes, currently it is unspecified, and in fact we return false for a very long
time. Returning false makes no sense from my point of view. On the other hand
we don't care much about the return value currently. For example free() does a
NULL check itself. The _Heap_is_block_in_heap() rejects a NULL.
You encountered a bug in _Heap_Protection_block_check_default() which should
check for NULL as a special case.
>
> _Heap_Block_size(block), _Heap_is_free(block), _Heap_is_block_in_heap(const Heap_Control *heap, const Heap_Block *block).
>
> Ideally the definition should be derived from a concise definition of what a NULL heap block pointer means, and those operations that are undefined should be specified as undefined.
>
> One could argue that _Heap_Block_size(0) == 0, _Heap_is_free(0) == true, _Heap_is_block_in_heap(0, *) == true. I'm not arguing it, though, since I'm not presenting the "concise definition" I mention above.
These are all internal heap functions. They must work only with pointers to an
allocated area.
>
> Peter
> -----------------
> Peter Dufault
> HD Associates, Inc. Software and System Engineering
>
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the users
mailing list