From: Ivan Maidanski Date: Tue, 10 Sep 2019 20:09:29 +0000 (+0300) Subject: Remove redundant check of GC_free argument in register_finalizer X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88718771d6aa4bf79d50585add2e3f9e12deee34;p=gc Remove redundant check of GC_free argument in register_finalizer (code refactoring) This also works around "Argument new_fo to function GC_free is always 1" cppcheck false positive. * finalize.c [!DBG_HDRS_ALL] (GC_register_finalizer_inner): Do not check new_fo is non-NULL before GC_free(new_fo) call. --- diff --git a/finalize.c b/finalize.c index 0dde1a69..c8708b95 100644 --- a/finalize.c +++ b/finalize.c @@ -775,10 +775,8 @@ STATIC void GC_register_finalizer_inner(void * obj, GC_dirty(GC_fnlz_roots.fo_head + index); UNLOCK(); # ifndef DBG_HDRS_ALL - if (EXPECT(new_fo != 0, FALSE)) { /* Free unused new_fo returned by GC_oom_fn() */ GC_free((void *)new_fo); - } # endif return; }