[alsa-devel] [patch 1/4] ASoC: dapm: fix error path in snd_soc_dapm_new_pcm

anish kumar yesanishhere at gmail.com
Sat Aug 26 10:29:25 CEST 2017


Before freeing the memory, check if it was allcoated.

Signed-off-by: anish kumar <yesanishhere at gmail.com>
---
 sound/soc/soc-dapm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dcef67a..6e10a9a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3907,9 +3907,10 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 	devm_kfree(card->dev, (void *)private_value);
 outfree_link_name:
 	devm_kfree(card->dev, link_name);
-outfree_w_param:
 	for (count = 0 ; count < num_params; count++)
-		devm_kfree(card->dev, (void *)w_param_text[count]);
+            if (w_param_text[count])
+	        devm_kfree(card->dev, (void *)w_param_text[count]);
+outfree_w_param:
 	devm_kfree(card->dev, w_param_text);
 
 	return ret;
-- 
2.10.1 (Apple Git-78)



More information about the Alsa-devel mailing list