From: Marco Bettini Date: Thu, 12 Jun 2025 07:45:29 +0000 (+0000) Subject: lib-dns-client: dns_client_cache_clean(), Fix for static checker failing to see that... X-Git-Tag: 2.4.2~704 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29d3a56369eedee099c854e1a72a55f4a19c3950;p=thirdparty%2Fdovecot%2Fcore.git lib-dns-client: dns_client_cache_clean(), Fix for static checker failing to see that priorityq_peek() cannot return NULL Found by Coverity, 40466 Dereference null return value --- diff --git a/src/lib-dns-client/dns-client-cache.c b/src/lib-dns-client/dns-client-cache.c index 0c532ba39d..addec5365e 100644 --- a/src/lib-dns-client/dns-client-cache.c +++ b/src/lib-dns-client/dns-client-cache.c @@ -135,8 +135,8 @@ bool dns_client_cache_lookup(struct dns_client_cache *cache, static void dns_client_cache_clean(struct dns_client_cache *cache) { - while (priorityq_count(cache->queue) > 0) { - struct priorityq_item *item = priorityq_peek(cache->queue); + struct priorityq_item *item; + while ((item = priorityq_peek(cache->queue)) != NULL) { struct dns_client_cache_entry *entry = container_of(item, struct dns_client_cache_entry, item); if (entry->expires <= ioloop_time) {