Address things that came out of VS static analysis

Except for the stack usage cases
This commit is contained in:
Willem Toorop 2016-12-09 12:57:47 +01:00
parent 3428412629
commit 4345905a81
4 changed files with 13 additions and 2 deletions

View File

@ -419,7 +419,7 @@ sockaddr_dict(getdns_context *context, struct sockaddr *sa)
break;
port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
if (port != GETDNS_PORT_DNS && port != GETDNS_PORT_DNS &&
if (port != GETDNS_PORT_ZERO && port != GETDNS_PORT_DNS &&
getdns_dict_set_int(address, "port", (uint32_t)port))
break;

View File

@ -616,6 +616,11 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
head->node_count = node_count;
if (!node_count) {
/* When this head has no nodes of itself, it must have found
* another head which has nodes for its labels (i.e. max_head)
*/
assert(max_head != NULL);
head->parent = max_head->parent;
return head;
}
@ -1090,6 +1095,9 @@ static void val_chain_node_soa_cb(getdns_dns_req *dnsreq)
_getdns_rrset *rrset;
_getdns_context_clear_outbound_request(dnsreq);
/* A SOA query is always scheduled with a node as the user argument.
*/
assert(node != NULL);
for ( i = _getdns_rrset_iter_init(&i_spc, netreq->response
, netreq->response_len

View File

@ -126,7 +126,7 @@ default_eventloop_clear(getdns_eventloop *loop, getdns_eventloop_event *event)
DEBUG_SCHED( "%s(loop: %p, event: %p)\n", __FUNCTION__, loop, event);
i = (intptr_t)event->ev - 1;
if (i < 0 || i > FD_SETSIZE) {
if (i < 0 || i >= FD_SETSIZE) {
return GETDNS_RETURN_GENERIC_ERROR;
}
if (event->timeout_cb && !event->read_cb && !event->write_cb) {

View File

@ -353,6 +353,9 @@ _getdns_list_copy(const struct getdns_list * srclist,
retval = _getdns_list_append_dict(*dstlist,
srclist->items[i].data.dict);
break;
default:
retval = GETDNS_RETURN_WRONG_TYPE_REQUESTED;
break;
}
if (retval != GETDNS_RETURN_GOOD) {
getdns_list_destroy(*dstlist);