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.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c
index 5f51340743..c921fe841f 100644
--- a/src/resolve/resolved-dns-query.c
+++ b/src/resolve/resolved-dns-query.c
@@ -1,22 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2014 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
#include "alloc-util.h"
#include "dns-domain.h"
@@ -638,8 +620,7 @@ static int dns_query_synthesize_reply(DnsQuery *q, DnsTransactionState *state) {
dns_query_reset_answer(q);
- q->answer = answer;
- answer = NULL;
+ q->answer = TAKE_PTR(answer);
q->answer_rcode = DNS_RCODE_SUCCESS;
q->answer_protocol = dns_synthesize_protocol(q->flags);
q->answer_family = dns_synthesize_family(q->flags);
@@ -668,8 +649,7 @@ static int dns_query_try_etc_hosts(DnsQuery *q) {
dns_query_reset_answer(q);
- q->answer = answer;
- answer = NULL;
+ q->answer = TAKE_PTR(answer);
q->answer_rcode = DNS_RCODE_SUCCESS;
q->answer_protocol = dns_synthesize_protocol(q->flags);
q->answer_family = dns_synthesize_family(q->flags);
@@ -994,12 +974,10 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname)
q->flags |= SD_RESOLVED_NO_SEARCH;
dns_question_unref(q->question_idna);
- q->question_idna = nq_idna;
- nq_idna = NULL;
+ q->question_idna = TAKE_PTR(nq_idna);
dns_question_unref(q->question_utf8);
- q->question_utf8 = nq_utf8;
- nq_utf8 = NULL;
+ q->question_utf8 = TAKE_PTR(nq_utf8);
dns_query_free_candidates(q);
dns_query_reset_answer(q);