]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
utils/cache_gc/kr_cache_gc.c: replace asserts
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 24 Mar 2021 16:44:48 +0000 (17:44 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 25 May 2021 12:39:43 +0000 (14:39 +0200)
utils/cache_gc/kr_cache_gc.c

index 068c457e5c72b99b182977f29219ca35fe338393..a35c393baa074fe89f8590fb6946575b288fc127 100644 (file)
@@ -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) {