Skip to content

Commit 6d544ea

Browse files
Dan Carpenterbroonie
authored andcommitted
ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
These error paths should free comp_dai before returning. Fixes: 909dadf ("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]>
1 parent 04c319e commit 6d544ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/sof/ipc3-topology.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,22 +1588,23 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
15881588
ret = sof_update_ipc_object(scomp, comp_dai, SOF_DAI_TOKENS, swidget->tuples,
15891589
swidget->num_tuples, sizeof(*comp_dai), 1);
15901590
if (ret < 0)
1591-
goto free;
1591+
goto free_comp;
15921592

15931593
/* update comp_tokens */
15941594
ret = sof_update_ipc_object(scomp, &comp_dai->config, SOF_COMP_TOKENS,
15951595
swidget->tuples, swidget->num_tuples,
15961596
sizeof(comp_dai->config), 1);
15971597
if (ret < 0)
1598-
goto free;
1598+
goto free_comp;
15991599

16001600
/* Subtract the base to match the FW dai index. */
16011601
if (comp_dai->type == SOF_DAI_INTEL_ALH) {
16021602
if (comp_dai->dai_index < INTEL_ALH_DAI_INDEX_BASE) {
16031603
dev_err(sdev->dev,
16041604
"Invalid ALH dai index %d, only Pin numbers >= %d can be used\n",
16051605
comp_dai->dai_index, INTEL_ALH_DAI_INDEX_BASE);
1606-
return -EINVAL;
1606+
ret = -EINVAL;
1607+
goto free_comp;
16071608
}
16081609
comp_dai->dai_index -= INTEL_ALH_DAI_INDEX_BASE;
16091610
}

0 commit comments

Comments
 (0)