]> git.alsa-project.org Git - alsa-lib.git/commitdiff
coverity fixes
authorJaroslav Kysela <perex@perex.cz>
Tue, 12 Jan 2016 15:25:42 +0000 (16:25 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 12 Jan 2016 15:26:58 +0000 (16:26 +0100)
aserver/aserver.c
src/control/control.c
src/control/ctlparse.c
src/control/namehint.c
src/pcm/pcm_multi.c

index 1579da7b44eb394e07ace6c5635db545145e09f9..ac20706b9e0bf95a82c4d1d67a7f28d883c2813a 100644 (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;
index 8504d07668cdb0889f41307f9172a38406aeb71e..328920d989c3099e8d106b6d60bd1a60ddc7681b 100644 (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;
index 877a05e3a1f1a085fda73dbc8ab924c3282de445..d38b44ef986c5c30445a1a20e3d9ea8b766a2439 100644 (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);
index b3e646eb10af5da9ee6b77aa433deb2b41e6f9e6..856957c76d74cfd504861aef80e7ed8de6d8f36b 100644 (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;
index 4b8299ed6bcd08da933ecec1f7d8536dee2da35e..c4b1fba32cacb95edf3097e9498a8a3ba47d6081 100644 (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;
                }