NULL call to _Workspace_Free() via _Objects_Extend_information at startup
Chris Johns
chrisj at rtems.org
Tue Mar 1 03:57:56 UTC 2011
On 1/03/11 11:25 AM, Peter Dufault wrote:
>
> On Feb 28, 2011, at 7:16 , Chris Johns wrote:
>
>> It will be ignored just like 'free'. We will just use the 'in heap call'
>> to do this. Treating NULL as a special case has meant the bugs where
>> hidden and if a non-NULL bad pointer is passed in no protection to the
>> user is provided.
>
> If the change is in _Heap_Free() you'll want to formally redefine it to ignore NULL.
I can see a need for us to add the check. The patch I have attached to
the PR does handle NULL as described above but the heap free returns
falese and that in turn results in a printk in free. I think calling
free with NULL should be silent.
> It currently isn't defined that way:
>
> Frees the allocated memory area starting at addr in the heap heap.
If the address is in the heap's continuous memory region.
> Inappropriate values for addr may corrupt the heap.
I cannot see this. Do you have a use case that shows this ?
> Returns true in case of success, and false otherwise.
I assume calling 'free(NULL)' should result in heap free returning true.
As stated my patch does not do this.
Chris
More information about the users
mailing list