From 0a340a7188ca3ad014b4e6a15cae41e297c43fc0 Mon Sep 17 00:00:00 2001 From: Tomas Krizek <tomas.krizek@nic.cz> Date: Wed, 24 Mar 2021 17:44:48 +0100 Subject: [PATCH] utils/cache_gc/kr_cache_gc.c: replace asserts --- utils/cache_gc/kr_cache_gc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) { -- GitLab