]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: next round of coverity fixes
authorJaroslav Kysela <perex@perex.cz>
Mon, 27 May 2019 12:05:12 +0000 (14:05 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 27 May 2019 12:05:12 +0000 (14:05 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/topology/data.c
src/topology/parser.c

index aa2b87e73f50c7c832dbb7ed27e0a3057eeee9e1..b3f4421f5d5c7f2fd757bfc0caff879ad7a3d9fb 100644 (file)
@@ -88,8 +88,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
        if (fp == NULL) {
                SNDERR("error: invalid data file path '%s'\n",
                        filename);
-               ret = -errno;
-               goto err;
+               return -errno;
        }
 
        fseek(fp, 0L, SEEK_END);
@@ -463,6 +462,7 @@ static int copy_tuples(struct tplg_elem *elem,
 
                off = priv->size;
                priv->size = size; /* update private data size */
+               elem->data = priv;
 
                array = (struct snd_soc_tplg_vendor_array *)(priv->data + off);
                array->size = set_size;
@@ -499,7 +499,6 @@ static int copy_tuples(struct tplg_elem *elem,
                }
        }
 
-       elem->data = priv;
        return 0;
 }
 
index a7cff1c30edce4ea14e43831ee6b054213d76c91..5940692da2e2f7ea3159d33138b05c934a7b8425 100644 (file)
@@ -253,8 +253,10 @@ static int tplg_load_config(const char *file, snd_config_t **cfg)
        }
 
        ret = snd_input_close(in);
-       if (ret < 0)
+       if (ret < 0) {
+               in = NULL;
                goto err_load;
+       }
 
        *cfg = top;
        return 0;
@@ -262,7 +264,8 @@ static int tplg_load_config(const char *file, snd_config_t **cfg)
 err_load:
        snd_config_delete(top);
 err:
-       snd_input_close(in);
+       if (in)
+               snd_input_close(in);
        return ret;
 }