summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-cache.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-03-17 14:34:36 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2021-03-17 18:56:33 +0000
commit18da93648169f9bbf48a979031bd634c4bee7e95 (patch)
tree2a7304912f2b5a36d869be155d438f91af6e1ec6 /src/resolve/resolved-dns-cache.c
parent04820600e712affce95fcbab13de55edef216753 (diff)
downloadsystemd-18da93648169f9bbf48a979031bd634c4bee7e95.tar.gz
resolved: simplify min_ttl check
rr is asserted upon a few lines above, no need to check for null. Coverity-found issue, CID 1450844 CID 1450844: Null pointer dereferences (REVERSE_INULL) Null-checking "rr" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r--src/resolve/resolved-dns-cache.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 9b2e7115c0..c019dc38c9 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -439,9 +439,7 @@ static int dns_cache_put_positive(
/* Determine the minimal TTL of all RRs in the answer plus the one by the main RR we are supposed to
* cache. Since we cache whole answers to questions we should never return answers where only some
* RRs are still valid, hence find the lowest here */
- min_ttl = dns_answer_min_ttl(answer);
- if (rr)
- min_ttl = MIN(min_ttl, rr->ttl);
+ min_ttl = MIN(dns_answer_min_ttl(answer), rr->ttl);
/* New TTL is 0? Delete this specific entry... */
if (min_ttl <= 0) {