From: Vladimír Čunát Date: Tue, 25 Nov 2025 11:27:51 +0000 (+0100) Subject: lib/cache nit: explicitly free kr_cache_emergency_file_to_remove X-Git-Tag: v6.0.17~2^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d69399810901e6b6bff428b4853c5fbf0fa8c3d;p=thirdparty%2Fknot-resolver.git lib/cache nit: explicitly free kr_cache_emergency_file_to_remove Also simplify the related code a little. I don't think this has any practical impact. --- diff --git a/lib/cache/api.c b/lib/cache/api.c index 2cc32a13d..003b73513 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -140,13 +140,9 @@ int kr_cache_open(struct kr_cache *cache, const struct kr_cdb_api *api, struct k ret = cache->api->open(&cache->db, &cache->stats, &opts2, mm); } - char *fpath = kr_absolutize_path(opts->path, "data.mdb"); - if (kr_fails_assert(fpath)) { - /* non-critical, but still */ - fpath = ""; - } else { - kr_cache_emergency_file_to_remove = fpath; - } + free_const(kr_cache_emergency_file_to_remove); + kr_cache_emergency_file_to_remove = kr_absolutize_path(opts->path, "data.mdb"); + kr_assert(kr_cache_emergency_file_to_remove); // non-critical, but still size_t maxsize = 0; if (ret == 0) { @@ -194,7 +190,7 @@ void kr_cache_close(struct kr_cache *cache) cache_op(cache, close); cache->db = NULL; } - free(/*const-cast*/(char*)kr_cache_emergency_file_to_remove); + free_const(kr_cache_emergency_file_to_remove); kr_cache_emergency_file_to_remove = NULL; }