[kservice] add NULL check for rt_free and rt_free_align.
This commit is contained in:
parent
5ccf6a0fa8
commit
33be34d8ec
|
@ -1551,6 +1551,8 @@ RT_WEAK void rt_free(void *rmem)
|
||||||
|
|
||||||
/* call 'rt_free' hook */
|
/* call 'rt_free' hook */
|
||||||
RT_OBJECT_HOOK_CALL(rt_free_hook, (rmem));
|
RT_OBJECT_HOOK_CALL(rt_free_hook, (rmem));
|
||||||
|
/* NULL check */
|
||||||
|
if (rmem == RT_NULL) return;
|
||||||
/* Enter critical zone */
|
/* Enter critical zone */
|
||||||
level = _heap_lock();
|
level = _heap_lock();
|
||||||
_MEM_FREE(rmem);
|
_MEM_FREE(rmem);
|
||||||
|
@ -1672,6 +1674,8 @@ RT_WEAK void rt_free_align(void *ptr)
|
||||||
{
|
{
|
||||||
void *real_ptr;
|
void *real_ptr;
|
||||||
|
|
||||||
|
/* NULL check */
|
||||||
|
if (ptr == RT_NULL) return;
|
||||||
real_ptr = (void *) * (rt_ubase_t *)((rt_ubase_t)ptr - sizeof(void *));
|
real_ptr = (void *) * (rt_ubase_t *)((rt_ubase_t)ptr - sizeof(void *));
|
||||||
rt_free(real_ptr);
|
rt_free(real_ptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue