summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2021-03-18 13:14:32 +0100
committerDavid Tardon <dtardon@redhat.com>2021-03-18 13:19:00 +0100
commit516a00e9cf491f6da336dd2e1f6fa3c2ed82712a (patch)
treebfcc65e52b3e423699382e413ef8faf7ac13cd9c /src/resolve
parentbc8334017615d8ae5809323c583b5ec4dea6bbd8 (diff)
downloadsystemd-516a00e9cf491f6da336dd2e1f6fa3c2ed82712a.tar.gz
resolved-dns-rr: avoid unnecessary reassignment
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-rr.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c
index 66ed24c817..96024f6ca2 100644
--- a/src/resolve/resolved-dns-rr.c
+++ b/src/resolve/resolved-dns-rr.c
@@ -965,7 +965,6 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
case DNS_TYPE_DNSKEY: {
_cleanup_free_ char *alg = NULL;
- char *ss;
uint16_t key_tag;
key_tag = dnssec_keytag(rr, true);
@@ -974,7 +973,7 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (r < 0)
return NULL;
- r = asprintf(&s, "%s %u %u %s",
+ r = asprintf(&t, "%s %u %u %s",
k,
rr->dnskey.flags,
rr->dnskey.protocol,
@@ -982,24 +981,22 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
if (r < 0)
return NULL;
- r = base64_append(&s, r,
+ r = base64_append(&t, r,
rr->dnskey.key, rr->dnskey.key_size,
8, columns());
if (r < 0)
return NULL;
- r = asprintf(&ss, "%s\n"
+ r = asprintf(&s, "%s\n"
" -- Flags:%s%s%s\n"
" -- Key tag: %u",
- s,
+ t,
rr->dnskey.flags & DNSKEY_FLAG_SEP ? " SEP" : "",
rr->dnskey.flags & DNSKEY_FLAG_REVOKE ? " REVOKE" : "",
rr->dnskey.flags & DNSKEY_FLAG_ZONE_KEY ? " ZONE_KEY" : "",
key_tag);
if (r < 0)
return NULL;
- free(s);
- s = ss;
break;
}