Skip to contentSkip to conversation

ASoC: amd: fix memory leak of i2s_data on error return

PATCH New Colin King 1 participant 1 message Nov 14, 2018

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ASoC: amd: fix memory leak of i2s_data on error return

From: Colin Ian King <[email protected]>

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")
---
 sound/soc/amd/raven/acp3x-pcm-dma.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/amd/raven/acp3x-pcm-dma.c +1 -0
index 2e61cef00f41..b16cdd187139 100644
@@ -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;
 	}
 
Signature · 1 line
2.19.1