]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dns-client: dns_client_cache_clean(), Fix for static checker failing to see that...
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 12 Jun 2025 07:45:29 +0000 (07:45 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Fri, 27 Jun 2025 13:54:52 +0000 (13:54 +0000)
Found by Coverity, 40466 Dereference null return value

src/lib-dns-client/dns-client-cache.c

index 0c532ba39d5893ed3270e19f1067261f53814716..addec5365e3b304754d87223a3aecaed7a24a5b9 100644 (file)
@@ -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) {