summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-query.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-dns-query.c')
-rw-r--r--src/resolve/resolved-dns-query.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c
index b62c5c349f..175fbe2296 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/resolved-dns-query.c
@@ -850,17 +850,14 @@ static void dns_query_accept(DnsQuery *q, DnsQueryCandidate *c) {
q->answer_query_flags |= dns_transaction_source_to_query_flags(t->answer_source);
} else {
/* Override non-successful previous answers */
- dns_answer_unref(q->answer);
- q->answer = dns_answer_ref(t->answer);
-
+ DNS_ANSWER_REPLACE(q->answer, dns_answer_ref(t->answer));
q->answer_query_flags = dns_transaction_source_to_query_flags(t->answer_source);
}
q->answer_rcode = t->answer_rcode;
q->answer_errno = 0;
- dns_packet_unref(q->answer_full_packet);
- q->answer_full_packet = dns_packet_ref(t->received);
+ DNS_PACKET_REPLACE(q->answer_full_packet, dns_packet_ref(t->received));
if (FLAGS_SET(t->answer_query_flags, SD_RESOLVED_AUTHENTICATED)) {
has_authenticated = true;
@@ -896,14 +893,12 @@ static void dns_query_accept(DnsQuery *q, DnsQueryCandidate *c) {
!FLAGS_SET(t->answer_query_flags, SD_RESOLVED_AUTHENTICATED))
continue;
- dns_answer_unref(q->answer);
- q->answer = dns_answer_ref(t->answer);
+ DNS_ANSWER_REPLACE(q->answer, dns_answer_ref(t->answer));
q->answer_rcode = t->answer_rcode;
q->answer_dnssec_result = t->answer_dnssec_result;
q->answer_query_flags = t->answer_query_flags | dns_transaction_source_to_query_flags(t->answer_source);
q->answer_errno = t->answer_errno;
- dns_packet_unref(q->answer_full_packet);
- q->answer_full_packet = dns_packet_ref(t->received);
+ DNS_PACKET_REPLACE(q->answer_full_packet, dns_packet_ref(t->received));
state = t->state;
break;