Skip to content
Snippets Groups Projects
Commit 0e2b2824 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

cppcheck: resolve some issues

parent ffc02e9d
No related branches found
No related tags found
No related merge requests found
......@@ -203,13 +203,12 @@ char *sockaddr_hostname(void)
}
/* Fetch canonical name for this address/DNS. */
int ret = 0;
struct addrinfo hints, *info;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_CANONNAME;
if ((ret = getaddrinfo(host, "domain", &hints, &info)) != 0) {
if (getaddrinfo(host, "domain", &hints, &info) != 0) {
return NULL;
}
......
......@@ -125,6 +125,7 @@ static int stat_gatherer_add_data(stat_t *stat)
}
tmp->addr = malloc(sizeof(char) * 24);
if (tmp->addr == NULL) {
free(tmp)
ERR_ALLOC_FAILED;
return -1;
}
......
......@@ -556,7 +556,7 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
const knot_tsig_key_t *key, uint8_t *to_sign,
size_t to_sign_len)
{
if (!msg || !msg_len || !key || !key || !digest || !digest_len) {
if (!msg || !msg_len || !key || !digest || !digest_len) {
return KNOT_EINVAL;
}
......
......@@ -230,14 +230,6 @@ short knot_node_rrset_count(const knot_node_t *node)
/*----------------------------------------------------------------------------*/
struct knot_node_save_rrset_arg {
knot_rrset_t **array;
size_t count;
size_t max_count;
};
/*----------------------------------------------------------------------------*/
knot_rrset_t **knot_node_get_rrsets(const knot_node_t *node)
{
if (node == NULL || node->rrset_count == 0) {
......
......@@ -346,7 +346,7 @@ int net_receive(const net_t *net, uint8_t *buf, const size_t buf_len)
pfd.revents = 0;
if (net->socktype == SOCK_STREAM) {
uint16_t msg_len;
uint16_t msg_len = 0;
uint32_t total = 0;
// Receive TCP message header.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment