浏览代码

[Kernel] Add object re-initialization check.

BernardXiong 6 年之前
父节点
当前提交
50a97669cf
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/object.c

+ 3 - 0
src/object.c

@@ -251,6 +251,9 @@ void rt_object_init(struct rt_object         *object,
 
 
     /* initialize object's parameters */
     /* 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 */
     /* set object type to static */
     object->type = type | RT_Object_Class_Static;
     object->type = type | RT_Object_Class_Static;