Workaround 'possible null pointer dereference' cppcheck warning (Darwin)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 26 Oct 2016 21:38:55 +0000 (00:38 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 26 Oct 2016 21:38:55 +0000 (00:38 +0300)
* darwin_stop_world.c [CPPCHECK] (GC_stack_range_for): Call ABORT if
p is NULL and thread_blocked is true.

darwin_stop_world.c

index 1225217..7cd5775 100644 (file)
@@ -142,6 +142,9 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p,
 #   endif
 
   } else if (thread_blocked) {
+#   if defined(CPPCHECK)
+      if (NULL == p) ABORT("Invalid GC_thread passed to GC_stack_range_for");
+#   endif
     lo = p->stop_info.stack_ptr;
 #   ifndef DARWIN_DONT_PARSE_STACK
       *phi = p->topOfStack;