1
0
Эх сурвалжийг харах

[Kernel] Add object re-initialization check.

BernardXiong 6 жил өмнө
parent
commit
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 */
 
+    /* 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;