Commit d07c3d6c authored by Ondřej Surý's avatar Ondřej Surý

Merge branch 'ondrej/scan-build-10-fixes' into 'master'

Fix new warnings reported by scan-build from LLVM/Clang 10

See merge request !3285
parents ec9f80ca ddd0d356
Pipeline #37583 failed with stages
in 3 minutes and 34 seconds
......@@ -754,6 +754,8 @@ ds_from_cds(dns_rdatalist_t *dslist, isc_buffer_t *buf, dns_rdata_t *cds) {
dns_rdata_ds_t ds;
dns_rdata_t *rdata;
REQUIRE(buf != NULL);
rdata = rdata_get();
result = dns_rdata_tostruct(cds, &ds, NULL);
......@@ -772,6 +774,8 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
isc_result_t result;
unsigned i, n;
REQUIRE(buf != NULL);
n = sizeof(dtype) / sizeof(dtype[0]);
for (i = 0; i < n; i++) {
if (dtype[i] != 0) {
......
......@@ -1251,6 +1251,7 @@ setup(void) {
#endif /* if CONTRIB_DLZ */
named_server_create(named_g_mctx, &named_g_server);
ENSURE(named_g_server != NULL);
sctx = named_g_server->sctx;
/*
......
......@@ -869,7 +869,7 @@ named_os_shutdownmsg(char *command, isc_buffer_t *text) {
pid_t pid;
/* Skip the command name. */
if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
if (strtok_r(command, " \t", &last) == NULL) {
return;
}
......
......@@ -252,6 +252,8 @@ get_addresses(const char *host, in_port_t port) {
isc_result_t result;
int found = 0, count;
REQUIRE(host != NULL);
if (*host == '/') {
result = isc_sockaddr_frompath(&serveraddrs[nserveraddrs],
host);
......@@ -1036,7 +1038,7 @@ main(int argc, char **argv) {
fatal("'%s' is not implemented", command);
}
if (nserveraddrs == 0) {
if (nserveraddrs == 0 && servername != NULL) {
get_addresses(servername, (in_port_t)remoteport);
}
......
......@@ -305,6 +305,7 @@ main(int argc, char *argv[]) {
isc_sockaddr_fromin(&sa, &ina, 53);
ISC_LIST_APPEND(sal, &sa, link);
REQUIRE(DNS_VIEW_VALID(view));
RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
&sal, dns_fwdpolicy_only) ==
ISC_R_SUCCESS);
......
......@@ -518,7 +518,6 @@ static bool
openssleddsa_isprivate(const dst_key_t *key) {
EVP_PKEY *pkey = key->keydata.pkey;
int len;
unsigned long err;
if (pkey == NULL) {
return (false);
......@@ -529,7 +528,7 @@ openssleddsa_isprivate(const dst_key_t *key) {
return (true);
}
/* can check if first error is EC_R_INVALID_PRIVATE_KEY */
while ((err = ERR_get_error()) != 0) {
while (ERR_get_error() != 0) {
/**/
}
......
......@@ -1114,7 +1114,8 @@ trim_zbits(dns_rpz_zbits_t zbits, dns_rpz_zbits_t found) {
x = zbits & found;
x &= (~x + 1);
x = (x << 1) - 1;
return (zbits &= x);
zbits &= x;
return (zbits);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment