coverity/109019: fixing "Sizeof not portable"

suspicious_sizeof: Passing argument 8UL /* sizeof (char const **) */ to
function xcalloc and then casting the return value to char ** is
suspicious.

In this particular case sizeof (char const **) happens to be
equal to sizeof (char const *), but this is not a portable as
This commit is contained in:
Chris Hall 2015-05-05 21:32:23 +12:00 committed by Chris Hall
parent 0b03399b8b
commit 2393074d5f

View File

@ -268,7 +268,7 @@ char **server_address_list(size_t *size)
return NULL;
}
char **addrs = xcalloc((size_t) servers.ga_len, sizeof(const char **));
char **addrs = xcalloc((size_t) servers.ga_len, sizeof(const char *));
for (int i = 0; i < servers.ga_len; i++) {
addrs[i] = xstrdup(((Server **)servers.ga_data)[i]->addr);
}