From 8b58fa8356f77f64e9525e745d090108c20a528e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 27 Oct 2016 00:38:55 +0300 Subject: [PATCH] Workaround 'possible null pointer dereference' cppcheck warning (Darwin) * darwin_stop_world.c [CPPCHECK] (GC_stack_range_for): Call ABORT if p is NULL and thread_blocked is true. --- darwin_stop_world.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 1225217..7cd5775 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -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; -- 2.7.4