Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df9a0511 authored by Fred Oh's avatar Fred Oh
Browse files

ASoC: PCM: fix memory leak issue after dpcm_path_get()



dpcm_path_get() allocates memory and dpcm_path_put() frees it. When
dpcm_get_path() return 0 or less, the function is returned without freeing
the memory.

CRs-fixed: 587950
Change-Id: I25fdbbbc32df72278ee3e9ef71db46d8fbb68b9b
Signed-off-by: default avatarFred Oh <fred@codeaurora.org>
parent 0da8194d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1908,6 +1908,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)

		paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list);
		if (paths < 0) {
			dpcm_path_put(&list);
			dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
					fe->dai_link->name,  "playback");
			mutex_unlock(&card->mutex);
@@ -1938,6 +1939,7 @@ capture:

		paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list);
		if (paths < 0) {
			dpcm_path_put(&list);
			dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
					fe->dai_link->name,  "capture");
			mutex_unlock(&card->mutex);
@@ -2002,6 +2004,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
	fe->dpcm[stream].runtime = fe_substream->runtime;

	if (dpcm_path_get(fe, stream, &list) <= 0) {
		dpcm_path_put(&list);
		dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
			fe->dai_link->name, stream ? "capture" : "playback");
	}