diff options
author | Kai Blin <kai@samba.org> | 2012-05-30 00:30:29 +0200 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2012-05-30 00:38:00 +0200 |
commit | 6a1ad76c5ef7f77475192cb17a26dd0ecc26aade (patch) | |
tree | 360ded0afabb55dd9e9faab147ce3d4cbc06fe07 /source4/dns_server | |
parent | 9d128bbb628bb2240cc95695c114d8befa331a6e (diff) | |
download | samba-6a1ad76c5ef7f77475192cb17a26dd0ecc26aade.tar.gz |
s4-dns: Use W_ERROR_HAVE_NO_MEMORY in create_response_rr
Diffstat (limited to 'source4/dns_server')
-rw-r--r-- | source4/dns_server/dns_query.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c index c78fab922a1..0e630582280 100644 --- a/source4/dns_server/dns_query.c +++ b/source4/dns_server/dns_query.c @@ -48,15 +48,11 @@ static WERROR create_response_rr(const struct dns_name_question *question, switch (rec->wType) { case DNS_QTYPE_CNAME: ans[ai].rdata.cname_record = talloc_strdup(ans, rec->data.cname); - if (ans[ai].rdata.cname_record == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].rdata.cname_record); break; case DNS_QTYPE_A: ans[ai].rdata.ipv4_record = talloc_strdup(ans, rec->data.ipv4); - if (ans[ai].rdata.ipv4_record == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].rdata.ipv4_record); break; case DNS_QTYPE_AAAA: ans[ai].rdata.ipv6_record = talloc_strdup(ans, rec->data.ipv6); @@ -72,21 +68,15 @@ static WERROR create_response_rr(const struct dns_name_question *question, ans[ai].rdata.srv_record.port = rec->data.srv.wPort; ans[ai].rdata.srv_record.target = talloc_strdup( ans, rec->data.srv.nameTarget); - if (ans[ai].rdata.srv_record.target == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].rdata.srv_record.target); break; case DNS_QTYPE_SOA: ans[ai].rdata.soa_record.mname = talloc_strdup( ans, rec->data.soa.mname); - if (ans[ai].rdata.soa_record.mname == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].rdata.soa_record.mname); ans[ai].rdata.soa_record.rname = talloc_strdup( ans, rec->data.soa.rname); - if (ans[ai].rdata.soa_record.rname == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].rdata.soa_record.rname); ans[ai].rdata.soa_record.serial = rec->data.soa.serial; ans[ai].rdata.soa_record.refresh = rec->data.soa.refresh; ans[ai].rdata.soa_record.retry = rec->data.soa.retry; @@ -98,15 +88,11 @@ static WERROR create_response_rr(const struct dns_name_question *question, break; case DNS_QTYPE_TXT: tmp = talloc_asprintf(ans, "\"%s\"", rec->data.txt.str[0]); - if (tmp == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(tmp); for (i=1; i<rec->data.txt.count; i++) { tmp = talloc_asprintf_append_buffer( tmp, " \"%s\"", rec->data.txt.str[i]); - if (tmp == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(tmp); } ans[ai].rdata.txt_record.txt = tmp; break; @@ -116,9 +102,7 @@ static WERROR create_response_rr(const struct dns_name_question *question, } ans[ai].name = talloc_strdup(ans, question->name); - if (ans[ai].name == NULL) { - return WERR_NOMEM; - } + W_ERROR_HAVE_NO_MEMORY(ans[ai].name); ans[ai].rr_type = rec->wType; ans[ai].rr_class = DNS_QCLASS_IN; ans[ai].ttl = rec->dwTtlSeconds; |