]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ASoC: amd: fix memory leak of i2s_data on error return
authorColin Ian King <colin.king@canonical.com>
Wed, 14 Nov 2018 21:31:48 +0000 (21:31 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 14 Nov 2018 22:01:02 +0000 (14:01 -0800)
Currently when snd_pcm_hw_constraint_integer fails there is
a memory leak of i2s_data on the error return path. Fix this by
kfree'ing i2s_data before returning.

Detected by CoverityScan, CID#1475479 ("Resource leak")

Fixes: 0b87d6bcd648 ("ASoC: amd: add acp3x pcm driver dma ops")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/raven/acp3x-pcm-dma.c

index 2e61cef00f41c3ab59b7304bae7e623a989cc40a..b16cdd187139a84f1e1c3990a45da01ddc504f68 100644 (file)
@@ -309,6 +309,7 @@ static int acp3x_dma_open(struct snd_pcm_substream *substream)
                                            SNDRV_PCM_HW_PARAM_PERIODS);
        if (ret < 0) {
                dev_err(component->dev, "set integer constraint failed\n");
+               kfree(i2s_data);
                return ret;
        }