Commit edd97cdd authored by Ondřej Surý's avatar Ondřej Surý Committed by Ondřej Surý
Browse files

Refactor dns_name_dup() usage using the semantic patch

parent 21902d0a
......@@ -800,10 +800,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_name_dup(dns_fixedname_name(&fname), mctx,
keys[i - 1]);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_dup(dns_fixedname_name(&fname), mctx, keys[i - 1]);
}
if (pushed != 0) {
pushed--;
......
......@@ -7403,7 +7403,7 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server,
server->session_keyname = isc_mem_get(mctx,
sizeof(dns_name_t));
dns_name_init(server->session_keyname, NULL);
CHECK(dns_name_dup(keyname, mctx, server->session_keyname));
dns_name_dup(keyname, mctx, server->session_keyname);
server->session_keyfile = isc_mem_strdup(mctx, keyfile);
......
......@@ -85,7 +85,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
dns_name_init(tctx->domain, NULL);
RETERR(dns_name_dup(name, mctx, tctx->domain));
dns_name_dup(name, mctx, tctx->domain);
}
obj = NULL;
......@@ -114,4 +114,3 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
dns_tkeyctx_destroy(&tctx);
return (result);
}
......@@ -244,8 +244,7 @@ lookup(const char *target) {
result = dns_name_fromtext(&name, &t, dns_rootname, 0, &namebuf);
check_result(result, "dns_name_fromtext %s", target);
result = dns_name_dup(&name, mctx, &client->name);
check_result(result, "dns_name_dup %s", target);
dns_name_dup(&name, mctx, &client->name);
options = 0;
options |= DNS_ADBFIND_INET;
......
......@@ -310,11 +310,8 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos)
/* Duplicate key name. */
if (source->elements[i].type == dns_aclelementtype_keyname) {
dns_name_init(&dest->elements[nelem+i].keyname, NULL);
result = dns_name_dup(&source->elements[i].keyname,
dest->mctx,
&dest->elements[nelem+i].keyname);
if (result != ISC_R_SUCCESS)
return result;
dns_name_dup(&source->elements[i].keyname, dest->mctx,
&dest->elements[nelem + i].keyname);
}
#if defined(HAVE_GEOIP2)
......
......@@ -1402,10 +1402,8 @@ set_target(dns_adb_t *adb, const dns_name_t *name, const dns_name_t *fname,
result = dns_rdata_tostruct(&rdata, &cname, NULL);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_name_dup(&cname.cname, adb->mctx, target);
dns_name_dup(&cname.cname, adb->mctx, target);
dns_rdata_freestruct(&cname);
if (result != ISC_R_SUCCESS)
return (result);
} else {
dns_rdata_dname_t dname;
......@@ -1433,9 +1431,7 @@ set_target(dns_adb_t *adb, const dns_name_t *name, const dns_name_t *fname,
dns_rdata_freestruct(&dname);
if (result != ISC_R_SUCCESS)
return (result);
result = dns_name_dup(new_target, adb->mctx, target);
if (result != ISC_R_SUCCESS)
return (result);
dns_name_dup(new_target, adb->mctx, target);
}
return (ISC_R_SUCCESS);
......@@ -1669,10 +1665,7 @@ new_adbname(dns_adb_t *adb, const dns_name_t *dnsname) {
return (NULL);
dns_name_init(&name->name, NULL);
if (dns_name_dup(dnsname, adb->mctx, &name->name) != ISC_R_SUCCESS) {
isc_mempool_put(adb->nmp, name);
return (NULL);
}
dns_name_dup(dnsname, adb->mctx, &name->name);
dns_name_init(&name->target, NULL);
name->magic = DNS_ADBNAME_MAGIC;
name->adb = adb;
......@@ -1775,10 +1768,7 @@ new_adblameinfo(dns_adb_t *adb, const dns_name_t *qname,
return (NULL);
dns_name_init(&li->qname, NULL);
if (dns_name_dup(qname, adb->mctx, &li->qname) != ISC_R_SUCCESS) {
isc_mempool_put(adb->limp, li);
return (NULL);
}
dns_name_dup(qname, adb->mctx, &li->qname);
li->magic = DNS_ADBLAMEINFO_MAGIC;
li->lame_timer = 0;
li->qtype = qtype;
......
......@@ -128,12 +128,8 @@ copy_ptr_targets(dns_byaddr_t *byaddr, dns_rdataset_t *rdataset) {
return (result);
name = isc_mem_get(byaddr->mctx, sizeof(*name));
dns_name_init(name, NULL);
result = dns_name_dup(&ptr.ptr, byaddr->mctx, name);
dns_name_dup(&ptr.ptr, byaddr->mctx, name);
dns_rdata_freestruct(&ptr);
if (result != ISC_R_SUCCESS) {
isc_mem_put(byaddr->mctx, name, sizeof(*name));
return (ISC_R_NOMEMORY);
}
ISC_LIST_APPEND(byaddr->event->names, name, link);
dns_rdata_reset(&rdata);
result = dns_rdataset_next(rdataset);
......
......@@ -200,7 +200,6 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
dns_catz_entry_t **nentryp)
{
dns_catz_entry_t *nentry;
isc_result_t result;
REQUIRE(mctx != NULL);
REQUIRE(nentryp != NULL && *nentryp == NULL);
......@@ -209,9 +208,7 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
dns_name_init(&nentry->name, NULL);
if (domain != NULL) {
result = dns_name_dup(domain, mctx, &nentry->name);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_dup(domain, mctx, &nentry->name);
}
dns_catz_options_init(&nentry->opts);
......@@ -219,10 +216,6 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
nentry->magic = DNS_CATZ_ENTRY_MAGIC;
*nentryp = nentry;
return (ISC_R_SUCCESS);
cleanup:
isc_mem_put(mctx, nentry, sizeof(dns_catz_entry_t));
return (result);
}
dns_name_t *
......@@ -650,10 +643,7 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep,
memset(new_zone, 0, sizeof(*new_zone));
dns_name_init(&new_zone->name, NULL);
result = dns_name_dup(name, catzs->mctx, &new_zone->name);
if (result != ISC_R_SUCCESS)
goto cleanup_newzone;
dns_name_dup(name, catzs->mctx, &new_zone->name);
result = isc_ht_init(&new_zone->entries, catzs->mctx, 4);
if (result != ISC_R_SUCCESS)
......@@ -688,7 +678,6 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep,
isc_ht_destroy(&new_zone->entries);
cleanup_name:
dns_name_free(&new_zone->name, catzs->mctx);
cleanup_newzone:
isc_mem_put(catzs->mctx, new_zone, sizeof(*new_zone));
return (result);
......@@ -960,12 +949,8 @@ catz_process_zones_entry(dns_catz_zone_t *zone, dns_rdataset_t *value,
dns_rdata_freestruct(&ptr);
return (ISC_R_FAILURE);
} else {
result = dns_name_dup(&ptr.ptr, zone->catzs->mctx,
&entry->name);
if (result != ISC_R_SUCCESS) {
dns_rdata_freestruct(&ptr);
return (result);
}
dns_name_dup(&ptr.ptr, zone->catzs->mctx,
&entry->name);
}
} else {
result = dns_catz_entry_new(zone->catzs->mctx, &ptr.ptr,
......@@ -1166,15 +1151,7 @@ catz_process_masters(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
ipkl->labels[i] = isc_mem_get(mctx,
sizeof(dns_name_t));
dns_name_init(ipkl->labels[i], NULL);
result = dns_name_dup(name, mctx, ipkl->labels[i]);
if (result != ISC_R_SUCCESS) {
if (keyname != NULL) {
dns_name_free(keyname, mctx);
isc_mem_put(mctx, keyname,
sizeof(dns_name_t));
}
return (result);
}
dns_name_dup(name, mctx, ipkl->labels[i]);
if (value->type == dns_rdatatype_txt)
ipkl->keys[i] = keyname;
......
......@@ -897,7 +897,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
ansname = isc_mem_get(mctx, sizeof(*ansname));
dns_name_init(ansname, NULL);
(void)dns_name_dup(aname, mctx, ansname);
dns_name_dup(aname, mctx, ansname);
}
switch (result) {
......
......@@ -1450,7 +1450,6 @@ get_key_struct(const dns_name_t *name, unsigned int alg,
dns_ttl_t ttl, isc_mem_t *mctx)
{
dst_key_t *key;
isc_result_t result;
int i;
key = isc_mem_get(mctx, sizeof(dst_key_t));
......@@ -1460,12 +1459,7 @@ get_key_struct(const dns_name_t *name, unsigned int alg,
key->key_name = isc_mem_get(mctx, sizeof(dns_name_t));
dns_name_init(key->key_name, NULL);
result = dns_name_dup(name, mctx, key->key_name);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, key->key_name, sizeof(dns_name_t));
isc_mem_put(mctx, key, sizeof(dst_key_t));
return (NULL);
}
dns_name_dup(name, mctx, key->key_name);
isc_refcount_init(&key->refs, 1);
isc_mem_attach(mctx, &key->mctx);
......
......@@ -315,7 +315,6 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
isc_mem_t *mctx;
dns_ecdbnode_t *node;
isc_result_t result;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(nodep != NULL && *nodep == NULL);
......@@ -333,12 +332,7 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
isc_mutex_init(&node->lock);
dns_name_init(&node->name, NULL);
result = dns_name_dup(name, mctx, &node->name);
if (result != ISC_R_SUCCESS) {
isc_mutex_destroy(&node->lock);
isc_mem_put(mctx, node, sizeof(*node));
return (result);
}
dns_name_dup(name, mctx, &node->name);
isc_refcount_init(&node->references, 1);
ISC_LIST_INIT(node->rdatasets);
......
......@@ -104,10 +104,7 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
dst->keys[i] = isc_mem_get(mctx,
sizeof(dns_name_t));
dns_name_init(dst->keys[i], NULL);
result = dns_name_dup(src->keys[i], mctx,
dst->keys[i]);
if (result != ISC_R_SUCCESS)
goto cleanup_keys;
dns_name_dup(src->keys[i], mctx, dst->keys[i]);
} else {
dst->keys[i] = NULL;
}
......@@ -120,10 +117,8 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
dst->labels[i] = isc_mem_get(mctx,
sizeof(dns_name_t));
dns_name_init(dst->labels[i], NULL);
result = dns_name_dup(src->labels[i], mctx,
dst->labels[i]);
if (result != ISC_R_SUCCESS)
goto cleanup_labels;
dns_name_dup(src->labels[i], mctx,
dst->labels[i]);
} else {
dst->labels[i] = NULL;
}
......@@ -132,7 +127,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
dst->count = src->count;
return (ISC_R_SUCCESS);
cleanup_labels:
do {
if (dst->labels[i] != NULL) {
if (dns_name_dynamic(dst->labels[i]))
......@@ -142,7 +136,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
}
} while (i-- > 0);
cleanup_keys:
do {
if (dst->keys[i] != NULL) {
if (dns_name_dynamic(dst->keys[i]))
......
......@@ -99,14 +99,10 @@ build_event(dns_lookup_t *lookup) {
dns_name_t *name = NULL;
dns_rdataset_t *rdataset = NULL;
dns_rdataset_t *sigrdataset = NULL;
isc_result_t result;
name = isc_mem_get(lookup->mctx, sizeof(dns_name_t));
dns_name_init(name, NULL);
result = dns_name_dup(dns_fixedname_name(&lookup->name),
lookup->mctx, name);
if (result != ISC_R_SUCCESS)
goto fail;
dns_name_dup(dns_fixedname_name(&lookup->name), lookup->mctx, name);
if (dns_rdataset_isassociated(&lookup->rdataset)) {
rdataset = isc_mem_get(lookup->mctx, sizeof(dns_rdataset_t));
......@@ -126,19 +122,6 @@ build_event(dns_lookup_t *lookup) {
lookup->event->sigrdataset = sigrdataset;
return (ISC_R_SUCCESS);
fail:
if (name != NULL) {
if (dns_name_dynamic(name))
dns_name_free(name, lookup->mctx);
isc_mem_put(lookup->mctx, name, sizeof(dns_name_t));
}
if (rdataset != NULL) {
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
isc_mem_put(lookup->mctx, rdataset, sizeof(dns_rdataset_t));
}
return (result);
}
static isc_result_t
......
......@@ -651,11 +651,7 @@ dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval) {
name = isc_mem_get(peer->mem, sizeof(dns_name_t));
dns_name_init(name, NULL);
result = dns_name_dup(dns_fixedname_name(&fname), peer->mem, name);
if (result != ISC_R_SUCCESS) {
isc_mem_put(peer->mem, name, sizeof(dns_name_t));
return (result);
}
dns_name_dup(dns_fixedname_name(&fname), peer->mem, name);
result = dns_peer_setkey(peer, &name);
if (result != ISC_R_SUCCESS)
......
......@@ -6337,9 +6337,7 @@ addnoqname(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
noqname->neg = NULL;
noqname->negsig = NULL;
noqname->type = neg.type;
result = dns_name_dup(&name, mctx, &noqname->name);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_dup(&name, mctx, &noqname->name);
result = dns_rdataslab_fromrdataset(&neg, mctx, &r, 0);
if (result != ISC_R_SUCCESS)
goto cleanup;
......@@ -6384,9 +6382,7 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
closest->neg = NULL;
closest->negsig = NULL;
closest->type = neg.type;
result = dns_name_dup(&name, mctx, &closest->name);
if (result != ISC_R_SUCCESS)
goto cleanup;
dns_name_dup(&name, mctx, &closest->name);
result = dns_rdataslab_fromrdataset(&neg, mctx, &r, 0);
if (result != ISC_R_SUCCESS)
goto cleanup;
......
......@@ -374,9 +374,11 @@ locator_pton(const char *src, unsigned char *dst) {
static inline isc_result_t
name_duporclone(const dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) {
if (mctx != NULL)
return (dns_name_dup(source, mctx, target));
dns_name_clone(source, target);
if (mctx != NULL) {
dns_name_dup(source, mctx, target);
} else {
dns_name_clone(source, target);
}
return (ISC_R_SUCCESS);
}
......
......@@ -3569,10 +3569,8 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) {
fcount_decr(fctx);
dns_name_free(&fctx->domain, fctx->mctx);
dns_name_init(&fctx->domain, NULL);
result = dns_name_dup(domain, fctx->mctx,
&fctx->domain);
if (result != ISC_R_SUCCESS)
return (result);
dns_name_dup(domain, fctx->mctx,
&fctx->domain);
result = fcount_incr(fctx, true);
if (result != ISC_R_SUCCESS)
return (result);
......@@ -4243,11 +4241,7 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
fcount_decr(fctx);
dns_name_free(&fctx->domain, fctx->mctx);
dns_name_init(&fctx->domain, NULL);
result = dns_name_dup(fname, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__);
goto cleanup;
}
dns_name_dup(fname, fctx->mctx, &fctx->domain);
result = fcount_incr(fctx, false);
if (result != ISC_R_SUCCESS) {
......@@ -4257,11 +4251,7 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
dns_name_free(&fctx->qmindcname, fctx->mctx);
dns_name_init(&fctx->qmindcname, NULL);
result = dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__);
goto cleanup;
}
dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
fctx->ns_ttl = fctx->nameservers.ttl;
fctx->ns_ttl_ok = true;
......@@ -4769,13 +4759,9 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
FCTXTRACE("create");
dns_name_init(&fctx->name, NULL);
result = dns_name_dup(name, mctx, &fctx->name);
if (result != ISC_R_SUCCESS)
goto cleanup_info;
dns_name_dup(name, mctx, &fctx->name);
dns_name_init(&fctx->qminname, NULL);
result = dns_name_dup(name, mctx, &fctx->qminname);
if (result != ISC_R_SUCCESS)
goto cleanup_qminname;
dns_name_dup(name, mctx, &fctx->qminname);
dns_name_init(&fctx->domain, NULL);
dns_rdataset_init(&fctx->nameservers);
......@@ -4900,42 +4886,24 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
goto cleanup_nameservers;
}
result = dns_name_dup(fname, mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
goto cleanup_nameservers;
}
result = dns_name_dup(dcname, mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
goto cleanup_domain;
}
dns_name_dup(fname, mctx, &fctx->domain);
dns_name_dup(dcname, mctx, &fctx->qmindcname);
fctx->ns_ttl = fctx->nameservers.ttl;
fctx->ns_ttl_ok = true;
} else {
/*
* We're in forward-only mode. Set the query domain.
*/
result = dns_name_dup(fname, mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
goto cleanup_name;
}
result = dns_name_dup(fname, mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
goto cleanup_domain;
}
dns_name_dup(fname, mctx, &fctx->domain);
dns_name_dup(fname, mctx, &fctx->qmindcname);
/*
* Disable query minimization
*/
options &= ~DNS_FETCHOPT_QMINIMIZE;
}
} else {
result = dns_name_dup(domain, mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
goto cleanup_name;
}
result = dns_name_dup(domain, mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
goto cleanup_domain;
}
dns_name_dup(domain, mctx, &fctx->domain);
dns_name_dup(domain, mctx, &fctx->qmindcname);
dns_rdataset_clone(nameservers, &fctx->nameservers);
fctx->ns_ttl = fctx->nameservers.ttl;
fctx->ns_ttl_ok = true;
......@@ -5070,14 +5038,8 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
cleanup_nameservers:
if (dns_rdataset_isassociated(&fctx->nameservers))
dns_rdataset_disassociate(&fctx->nameservers);
cleanup_name:
dns_name_free(&fctx->name, mctx);
cleanup_qminname:
dns_name_free(&fctx->qminname, mctx);
cleanup_info:
isc_mem_free(mctx, fctx->info);
isc_counter_detach(&fctx->qc);
......@@ -7108,11 +7070,7 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) {
fcount_decr(fctx);
dns_name_free(&fctx->domain, fctx->mctx);
dns_name_init(&fctx->domain, NULL);
result = dns_name_dup(&fctx->nsname, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
goto cleanup;
}
dns_name_dup(&fctx->nsname, fctx->mctx, &fctx->domain);
result = fcount_incr(fctx, true);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
......@@ -9209,21 +9167,12 @@ rctx_referral(respctx_t *rctx) {
}
dns_name_init(&fctx->domain, NULL);
result = dns_name_dup(rctx->ns_name, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
rctx->result = result;
return (ISC_R_COMPLETE);
}
dns_name_dup(rctx->ns_name, fctx->mctx, &fctx->domain);
if ((fctx->options & DNS_FETCHOPT_QMINIMIZE) != 0) {
dns_name_free(&fctx->qmindcname, fctx->mctx);
dns_name_init(&fctx->qmindcname, NULL);
result = dns_name_dup(rctx->ns_name, fctx->mctx,
&fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
rctx->result = result;
return (ISC_R_COMPLETE);
}
dns_name_dup(rctx->ns_name, fctx->mctx, &fctx->qmindcname);
result= fctx_minimize_qname(fctx);
if (result != ISC_R_SUCCESS) {
......@@ -9370,18 +9319,10 @@ rctx_nextserver(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo,
dns_name_free(&fctx->domain, fctx->mctx);
dns_name_init(&fctx->domain, NULL);
result = dns_name_dup(fname, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
return;
}
dns_name_dup(fname, fctx->mctx, &fctx->domain);
dns_name_free(&fctx->qmindcname, fctx->mctx);
dns_name_init(&fctx->qmindcname, NULL);
result = dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
return;
}
dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
result = fcount_incr(fctx, true);
if (result != ISC_R_SUCCESS) {
......@@ -10441,7 +10382,7 @@ log_fetch(const dns_name_t *name, dns_rdatatype_t type) {
static isc_result_t
fctx_minimize_qname(fetchctx_t *fctx) {
isc_result_t result;
isc_result_t result = ISC_R_SUCCESS;
unsigned int dlabels, nlabels;
REQUIRE(VALID_FCTX(fctx));
......@@ -10501,20 +10442,20 @@ fctx_minimize_qname(fetchctx_t *fctx) {
result = dns_name_concatenate(&underscore_name,
name, tname, &dbuf);
if (result == ISC_R_SUCCESS) {
result = dns_name_dup(tname, fctx->mctx,
&fctx->qminname);
dns_name_dup(tname, fctx->mctx,
&fctx->qminname);
}
fctx->qmintype = dns_rdatatype_a;
} else {
result = dns_name_dup(dns_fixedname_name(&fname),
fctx->mctx, &fctx->qminname);
dns_name_dup(dns_fixedname_name(&fname),
fctx->mctx, &fctx->qminname);
fctx->qmintype = dns_rdatatype_ns;
}
fctx->minimized = true;
} else {
/* Minimization is done, we'll ask for whole qname */
fctx->qmintype = fctx->type;
result = dns_name_dup(&fctx->name, fctx->mctx, &fctx->qminname);
dns_name_dup(&fctx->name, fctx->mctx, &fctx->qminname);
fctx->minimized = false;
}
......@@ -10858,7 +10799,6 @@ isc_result_t
dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
const dns_name_t *name, in_port_t port) {
alternate_t *a;
isc_result_t result;
REQUIRE(VALID_RESOLVER(resolver));
REQUIRE(!resolver->frozen);
......@@ -10872,11 +10812,7 @@ dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
a->isaddress = false;
a->_u._n.port = port;
dns_name_init(&a->_u._n.name, NULL);
result = dns_name_dup(name, resolver->mctx, &a->_u._n.name);
if (result != ISC_R_SUCCESS) {
isc_mem_put(resolver->mctx, a, sizeof(*a));
return (result);
}
dns_name_dup(name, resolver->mctx, &a->_u._n.name);
}
ISC_LINK_INIT(a, link);
ISC_LIST_APPEND(resolver->alternates, a, link);
......
......@@ -444,12 +444,7 @@ getnode(dns_sdballnodes_t *allnodes, const char *name, dns_sdbnode_t **nodep) {
return (result);
sdbnode->name = isc_mem_get(mctx, sizeof(dns_name_t));
dns_name_init(sdbnode->name, NULL);
result = dns_name_dup(newname, mctx, sdbnode->name);
if (result != ISC_R_SUCCESS) {