coverity fixes

This commit is contained in:
Jaroslav Kysela 2016-01-12 16:25:42 +01:00
parent 0f4f48d377
commit df20aa2a1e
5 changed files with 8 additions and 3 deletions

View file

@ -93,6 +93,7 @@ static int make_inet_socket(int port)
return result;
}
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = INADDR_ANY;

View file

@ -411,7 +411,7 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
bytes = 0;
for (i = 0; i < items; ++i)
bytes += strlen(names[i]) + 1;
buf = malloc(bytes);
buf = bytes ? malloc(bytes) : NULL;
if (!buf)
return -ENOMEM;
info->value.enumerated.names_ptr = (uintptr_t)buf;

View file

@ -62,7 +62,7 @@ static long get_integer(const char **ptr, long min, long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
strtol(p, &p, 10);
(void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long)convert_prange1(strtod(s, NULL), min, max);
@ -90,7 +90,7 @@ static long long get_integer64(const char **ptr, long long min, long long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
strtol(p, &p, 10);
(void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long long)convert_prange1(strtod(s, NULL), min, max);

View file

@ -559,6 +559,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (err < 0)
return err;
err = snd_config_copy(&local_config_rw, local_config);
if (err < 0)
return err;
list.list = NULL;
list.count = list.allocated = 0;
list.siface = iface;

View file

@ -888,6 +888,8 @@ static int snd_pcm_multi_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
slave_maps[i] = calloc(multi->slaves[i].channels_count + 1,
sizeof(int));
if (!slave_maps[i]) {
for (i++; i < multi->slaves_count; i++)
slave_maps[i] = NULL;
err = -ENOMEM;
goto error;
}