From 50a97669cf62b443aec80ac2a88297db817bf105 Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Tue, 26 Mar 2019 13:49:18 +0000 Subject: [PATCH] [Kernel] Add object re-initialization check. --- src/object.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/object.c b/src/object.c index 70b9a5c04e..050bb17757 100644 --- a/src/object.c +++ b/src/object.c @@ -251,6 +251,9 @@ void rt_object_init(struct rt_object *object, /* initialize object's parameters */ + /* check object type to avoid re-initialization */ + RT_ASSERT(object->type != (type | RT_Object_Class_Static)); + /* set object type to static */ object->type = type | RT_Object_Class_Static;