From 7547c377153ddd859bef6a2dd14c42e9f12aa0be Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 27 Sep 2016 20:39:44 +0300 Subject: [PATCH] Eliminate 'deref-of-null' static analyzer warning in register_finalizer * finalize.c (GC_register_finalizer_inner): Add GC_ASSERT that fn and hhdr are non-NULL (instead of specifying this in a comment) if new_fo is non-NULL (new_fo is returned by GC_oom_fn). --- finalize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalize.c b/finalize.c index 8b3afa0..514e42d 100644 --- a/finalize.c +++ b/finalize.c @@ -700,7 +700,8 @@ STATIC void GC_register_finalizer_inner(void * obj, curr_fo = fo_next(curr_fo); } if (EXPECT(new_fo != 0, FALSE)) { - /* new_fo is returned by GC_oom_fn(), so fn != 0 and hhdr != 0. */ + /* new_fo is returned by GC_oom_fn(). */ + GC_ASSERT(fn != 0 && hhdr != NULL); break; } if (fn == 0) { -- 2.7.4