]> Git Repo - J-linux.git/commitdiff
ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
authorDan Carpenter <[email protected]>
Sat, 30 Nov 2024 10:09:06 +0000 (13:09 +0300)
committerMark Brown <[email protected]>
Mon, 2 Dec 2024 13:30:43 +0000 (13:30 +0000)
These error paths should free comp_dai before returning.

Fixes: 909dadf21aae ("ASoC: SOF: topology: Make DAI widget parsing IPC agnostic")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
sound/soc/sof/ipc3-topology.c

index c2fce554a674bbd1f7092c493fa09bf7c99af8b7..e98b53b67d12b9340b2acb97429b74f7a3de5b35 100644 (file)
@@ -1588,14 +1588,14 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
        ret = sof_update_ipc_object(scomp, comp_dai, SOF_DAI_TOKENS, swidget->tuples,
                                    swidget->num_tuples, sizeof(*comp_dai), 1);
        if (ret < 0)
-               goto free;
+               goto free_comp;
 
        /* update comp_tokens */
        ret = sof_update_ipc_object(scomp, &comp_dai->config, SOF_COMP_TOKENS,
                                    swidget->tuples, swidget->num_tuples,
                                    sizeof(comp_dai->config), 1);
        if (ret < 0)
-               goto free;
+               goto free_comp;
 
        /* Subtract the base to match the FW dai index. */
        if (comp_dai->type == SOF_DAI_INTEL_ALH) {
@@ -1603,7 +1603,8 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
                        dev_err(sdev->dev,
                                "Invalid ALH dai index %d, only Pin numbers >= %d can be used\n",
                                comp_dai->dai_index, INTEL_ALH_DAI_INDEX_BASE);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto free_comp;
                }
                comp_dai->dai_index -= INTEL_ALH_DAI_INDEX_BASE;
        }
This page took 0.09805 seconds and 4 git commands to generate.