Compare commits

...

1 Commits

Author SHA1 Message Date
Matthijs Mekking
a16276abce Fix cppcheck warnings 2020-06-24 14:55:18 +02:00
8 changed files with 16 additions and 11 deletions

View File

@@ -1494,6 +1494,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
if (lookup->ednsopts == NULL) {
cloneopts(lookup, NULL);
}
INSIST(lookup->ednsopts != NULL);
if (lookup->ednsopts[lookup->ednsoptscnt].value != NULL) {
isc_mem_free(mctx, lookup->ednsopts[lookup->ednsoptscnt].value);

View File

@@ -362,6 +362,7 @@ main(int argc, char **argv) {
setup_logging(mctx, &log);
if (predecessor == NULL) {
/* cppcheck-suppress nullPointerRedundantCheck */
if (label == NULL) {
fatal("the key label was not specified");
}
@@ -383,6 +384,7 @@ main(int argc, char **argv) {
isc_result_totext(ret));
}
/* cppcheck-suppress nullPointerRedundantCheck */
if (strchr(label, ':') == NULL) {
char *l;
int len;
@@ -394,11 +396,13 @@ main(int argc, char **argv) {
label = l;
}
/* cppcheck-suppress nullPointerRedundantCheck */
if (algname == NULL) {
fatal("no algorithm specified");
}
r.base = algname;
/* cppcheck-suppress nullPointerRedundantCheck */
r.length = strlen(algname);
ret = dns_secalg_fromtext(&alg, &r);
if (ret != ISC_R_SUCCESS) {

View File

@@ -1180,10 +1180,12 @@ main(int argc, char **argv) {
}
if (ctx.predecessor == NULL && ctx.policy == NULL) {
/* cppcheck-suppress nullPointerRedundantCheck */
if (algname == NULL) {
fatal("no algorithm specified");
}
r.base = algname;
/* cppcheck-suppress nullPointerRedundantCheck */
r.length = strlen(algname);
ret = dns_secalg_fromtext(&ctx.alg, &r);
if (ret != ISC_R_SUCCESS) {

View File

@@ -39,7 +39,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.sp
\fBdnssec\-importkey\fP reads a public DNSKEY record and generates a pair
of .key/.private files. The DNSKEY record may be read from an existing
\&.key file, in which case a corresponding .private file will be
.key file, in which case a corresponding .private file will be
generated, or it may be read from any other file or from the standard
input, in which case both .key and .private files will be generated.
.sp

View File

@@ -2183,7 +2183,7 @@ failure:
dst_key_free(&state->zone_keys[i]);
}
if (state != &mystate && state != NULL) {
if (state != &mystate) {
*statep = NULL;
state->magic = 0;
isc_mem_put(diff->mctx, state, sizeof(*state));

View File

@@ -445,6 +445,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
if (ctx->basic_blocks == NULL) {
more_basic_blocks(ctx);
}
INSIST(ctx->basic_blocks != NULL);
total_size = ctx->mem_target;
tmp = ctx->basic_blocks;
@@ -516,6 +517,7 @@ mem_getunlocked(isc__mem_t *ctx, size_t size) {
if (ctx->freelists[new_size] == NULL) {
more_frags(ctx, new_size);
}
INSIST(ctx->freelists[new_size] != NULL);
/*
* The free list uses the "rounded-up" size "new_size".

View File

@@ -232,15 +232,15 @@ isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target,
*target = NULL;
if (radix->head == NULL) {
node = radix->head;
if (node == NULL) {
return (ISC_R_NOTFOUND);
}
node = radix->head;
addr = isc_prefix_touchar(prefix);
bitlen = prefix->bitlen;
while (node->bit < bitlen) {
while (node != NULL && node->bit < bitlen) {
if (node->prefix) {
stack[cnt++] = node;
}
@@ -251,13 +251,9 @@ isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target,
} else {
node = node->l;
}
if (node == NULL) {
break;
}
}
if (node && node->prefix) {
if (node != NULL && node->prefix) {
stack[cnt++] = node;
}

View File

@@ -1358,7 +1358,7 @@ process_ecs(ns_client_t *client, isc_buffer_t *buf, size_t optlen) {
}
paddr = (uint8_t *)&caddr.type;
if (addrbytes != 0U) {
if (addrbytes > 0U) {
memmove(paddr, isc_buffer_current(buf), addrbytes);
isc_buffer_forward(buf, addrbytes);
optlen -= addrbytes;