summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-dns-cache.c')
-rw-r--r--src/resolve/resolved-dns-cache.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index e7ab4e5569..395109dcb2 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -412,7 +412,6 @@ static int dns_cache_put_positive(
int owner_family,
const union in_addr_union *owner_address) {
- _cleanup_(dns_cache_item_freep) DnsCacheItem *i = NULL;
char key_str[DNS_RESOURCE_KEY_STRING_MAX];
DnsCacheItem *existing;
uint32_t min_ttl;
@@ -469,7 +468,7 @@ static int dns_cache_put_positive(
dns_cache_make_space(c, 1);
- i = new(DnsCacheItem, 1);
+ _cleanup_(dns_cache_item_freep) DnsCacheItem *i = new(DnsCacheItem, 1);
if (!i)
return -ENOMEM;
@@ -493,23 +492,17 @@ static int dns_cache_put_positive(
if (r < 0)
return r;
- if (DEBUG_LOGGING) {
- _cleanup_free_ char *t = NULL;
-
- (void) in_addr_to_string(i->owner_family, &i->owner_address, &t);
-
- log_debug("Added positive %s %s%s cache entry for %s "USEC_FMT"s on %s/%s/%s",
- FLAGS_SET(i->query_flags, SD_RESOLVED_AUTHENTICATED) ? "authenticated" : "unauthenticated",
- FLAGS_SET(i->query_flags, SD_RESOLVED_CONFIDENTIAL) ? "confidential" : "non-confidential",
- i->shared_owner ? " shared" : "",
- dns_resource_key_to_string(i->key, key_str, sizeof key_str),
- (i->until - timestamp) / USEC_PER_SEC,
- i->ifindex == 0 ? "*" : FORMAT_IFNAME(i->ifindex),
- af_to_name_short(i->owner_family),
- strna(t));
- }
+ log_debug("Added positive %s %s%s cache entry for %s "USEC_FMT"s on %s/%s/%s",
+ FLAGS_SET(i->query_flags, SD_RESOLVED_AUTHENTICATED) ? "authenticated" : "unauthenticated",
+ FLAGS_SET(i->query_flags, SD_RESOLVED_CONFIDENTIAL) ? "confidential" : "non-confidential",
+ i->shared_owner ? " shared" : "",
+ dns_resource_key_to_string(i->key, key_str, sizeof key_str),
+ (i->until - timestamp) / USEC_PER_SEC,
+ i->ifindex == 0 ? "*" : FORMAT_IFNAME(i->ifindex),
+ af_to_name_short(i->owner_family),
+ IN_ADDR_TO_STRING(i->owner_family, &i->owner_address));
- i = NULL;
+ TAKE_PTR(i);
return 0;
}