diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-07-30 14:21:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-07-30 14:21:18 +0200 |
commit | 0ec7c46eed06269edf80121ec53f1eba2e2870d4 (patch) | |
tree | 198b91a49383b23f4062f4e98a64d3537d1da897 /src/resolve/resolved-dns-cache.c | |
parent | 6bf02ccb14a8f9791b0896f1e95d6e0522dd59ed (diff) |
resolved: properly handle adding empty replies to cache
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r-- | src/resolve/resolved-dns-cache.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c index 28a375baed..7359dfa271 100644 --- a/src/resolve/resolved-dns-cache.c +++ b/src/resolve/resolved-dns-cache.c @@ -352,12 +352,16 @@ int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, uns int r; assert(c); - assert(answer); + assert(q); /* First, delete all matching old RRs, so that we only keep * complete by_key in place. */ for (i = 0; i < q->n_keys; i++) dns_cache_remove(c, q->keys[i]); + + if (!answer) + return 0; + for (i = 0; i < answer->n_rrs; i++) dns_cache_remove(c, answer->rrs[i]->key); |