ASoC: topology: free stream_name of dai_drv
authorBard liao <yung-chuan.liao@linux.intel.com>
Tue, 5 Mar 2019 15:57:52 +0000 (23:57 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 19 Mar 2019 11:50:06 +0000 (11:50 +0000)
The stream_name is allocated by kstrdup. We have to free it when the
dai is removed or return from error.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-topology.c

index fbee4720b8346b2cdc163871d5c4563eaa404dc6..1be60cea2bf541842b2ebc95b116ca888f0b2428 100644 (file)
@@ -535,6 +535,8 @@ static void remove_dai(struct snd_soc_component *comp,
                if (dai->driver == dai_drv)
                        dai->driver = NULL;
 
+       kfree(dai_drv->playback.stream_name);
+       kfree(dai_drv->capture.stream_name);
        kfree(dai_drv->name);
        list_del(&dobj->list);
        kfree(dai_drv);
@@ -1808,6 +1810,9 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
        ret = soc_tplg_dai_load(tplg, dai_drv, pcm, NULL);
        if (ret < 0) {
                dev_err(tplg->comp->dev, "ASoC: DAI loading failed\n");
+               kfree(dai_drv->playback.stream_name);
+               kfree(dai_drv->capture.stream_name);
+               kfree(dai_drv->name);
                kfree(dai_drv);
                return ret;
        }