summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kservice.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kservice.c b/src/kservice.c
index e8c53bd2ea..4e6dc22675 100644
--- a/src/kservice.c
+++ b/src/kservice.c
@@ -1551,6 +1551,8 @@ RT_WEAK void rt_free(void *rmem)
/* call 'rt_free' hook */
RT_OBJECT_HOOK_CALL(rt_free_hook, (rmem));
+ /* NULL check */
+ if (rmem == RT_NULL) return;
/* Enter critical zone */
level = _heap_lock();
_MEM_FREE(rmem);
@@ -1672,6 +1674,8 @@ RT_WEAK void rt_free_align(void *ptr)
{
void *real_ptr;
+ /* NULL check */
+ if (ptr == RT_NULL) return;
real_ptr = (void *) * (rt_ubase_t *)((rt_ubase_t)ptr - sizeof(void *));
rt_free(real_ptr);
}