Eliminate 'deref-of-null' static analyzer warning in register_finalizer
authorIvan Maidanski <ivmai@mail.ru>
Tue, 27 Sep 2016 17:39:44 +0000 (20:39 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 27 Sep 2016 17:39:44 +0000 (20:39 +0300)
* 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

index 8b3afa0..514e42d 100644 (file)
@@ -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) {