From: Tomas Krizek Date: Wed, 24 Mar 2021 16:44:48 +0000 (+0100) Subject: utils/cache_gc/kr_cache_gc.c: replace asserts X-Git-Tag: v5.4.0~18^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a340a7188ca3ad014b4e6a15cae41e297c43fc0;p=thirdparty%2Fknot-resolver.git utils/cache_gc/kr_cache_gc.c: replace asserts --- diff --git a/utils/cache_gc/kr_cache_gc.c b/utils/cache_gc/kr_cache_gc.c index 068c457e5..a35c393ba 100644 --- a/utils/cache_gc/kr_cache_gc.c +++ b/utils/cache_gc/kr_cache_gc.c @@ -151,7 +151,8 @@ struct kr_cache_gc_state { void kr_cache_gc_free_state(kr_cache_gc_state_t **state) { - assert(state); + if (!kr_assume(state)) + return; if (!*state) { // not open return; } @@ -164,7 +165,8 @@ int kr_cache_gc(kr_cache_gc_cfg_t *cfg, kr_cache_gc_state_t **state) { // The whole function works in four "big phases": //// 1. find out whether we should even do analysis and deletion. - assert(cfg && state); + if (!kr_assume(cfg && state)) + return KNOT_EINVAL; int ret; // Ensure that we have open and "healthy" cache. if (!*state) {