From: Noel Power Date: Tue, 9 Jul 2019 14:50:24 +0000 (+0000) Subject: lib/addns: clang: Fix 'Value stored to 'err' is never read' X-Git-Tag: tdb-1.4.2~481 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da4c1c5f39669274bf8ff5a0974b4111f80be798;p=thirdparty%2Fsamba.git lib/addns: clang: Fix 'Value stored to 'err' is never read' Fixes: /home/samba/samba/lib/addns/dnsmarshall.c:406:2: warning: Value stored to 'err' is never read <--[clang] err = ERROR_DNS_NO_MEMORY; ^ ~~~~~~~~~~~~~~~~~~~ /home/samba/samba/lib/addns/dnsmarshall.c:447:3: warning: Value stored to 'err' is never read <--[clang] err = buf->error; ^ ~~~~~~~~~~ 2 warnings generated. Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c index 3205786cbbb..a07ed784ce1 100644 --- a/lib/addns/dnsmarshall.c +++ b/lib/addns/dnsmarshall.c @@ -388,10 +388,10 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx, { struct dns_request *req; uint16_t i; - DNS_ERROR err; + DNS_ERROR err = ERROR_DNS_NO_MEMORY; if (!(req = talloc_zero(mem_ctx, struct dns_request))) { - return ERROR_DNS_NO_MEMORY; + return err; } dns_unmarshall_uint16(buf, &req->id); @@ -401,7 +401,10 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx, dns_unmarshall_uint16(buf, &req->num_auths); dns_unmarshall_uint16(buf, &req->num_additionals); - if (!ERR_DNS_IS_OK(buf->error)) goto error; + if (!ERR_DNS_IS_OK(buf->error)){ + err = buf->error; + goto error; + } err = ERROR_DNS_NO_MEMORY; @@ -452,7 +455,6 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx, return ERROR_DNS_SUCCESS; error: - err = buf->error; TALLOC_FREE(req); return err; }