Skip to content

Commit bd6327f

Browse files
Srinivasa Rao Mandadapubroonie
authored andcommitted
ASoC: qcom: lpass-platform: Fix memory leak
lpass_pcm_data is not freed in error paths. Free it in error paths to avoid memory leak. Fixes: 022d00e ("ASoC: lpass-platform: Fix broken pcm data usage") Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: V Sujith Kumar Reddy <vsujithk@codeaurora.org> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org> Link: https://lore.kernel.org/r/1605416210-14530-1-git-send-email-srivasam@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 1bd7b0f commit bd6327f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

sound/soc/qcom/lpass-platform.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,
122122
else
123123
dma_ch = 0;
124124

125-
if (dma_ch < 0)
125+
if (dma_ch < 0) {
126+
kfree(data);
126127
return dma_ch;
128+
}
127129

128130
if (cpu_dai->driver->id == LPASS_DP_RX) {
129131
map = drvdata->hdmiif_map;
@@ -147,6 +149,7 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component,
147149
ret = snd_pcm_hw_constraint_integer(runtime,
148150
SNDRV_PCM_HW_PARAM_PERIODS);
149151
if (ret < 0) {
152+
kfree(data);
150153
dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
151154
ret);
152155
return -EINVAL;

0 commit comments

Comments
 (0)