Skip to content

Commit

Permalink
ASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data
Browse files Browse the repository at this point in the history
In the implementation of sof_set_get_large_ctrl_data() there is a memory
leak in case an error. Release partdata if sof_get_ctrl_copy_params()
fails.

Fixes: 54d198d ("ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20191027215330.12729-1-navid.emamdoost@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Navidem authored and broonie committed Oct 28, 2019
1 parent c0a333d commit 45c1380
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,10 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev,
else
err = sof_get_ctrl_copy_params(cdata->type, partdata, cdata,
sparams);
if (err < 0)
if (err < 0) {
kfree(partdata);
return err;
}

msg_bytes = sparams->msg_bytes;
pl_size = sparams->pl_size;
Expand Down

0 comments on commit 45c1380

Please sign in to comment.