]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: SOF: topology: Fix memory leak in sof_control_load()
authorYu Liao <liaoyu15@huawei.com>
Fri, 18 Mar 2022 02:16:16 +0000 (10:16 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 7 Apr 2022 17:29:37 +0000 (18:29 +0100)
commitbb82b67db42ed6e129fa044ac02f826e01c363d0
treeae5b1f2074283728d81faea0e92a47903b17e225
parent848a983bf8c533f5bb829da4ae6fee0b50e5bd1b
ASoC: SOF: topology: Fix memory leak in sof_control_load()

scontrol doesn't get freed when kstrdup returns NULL.
Fix by free iscontrol in that case.

     scontrol = kzalloc(sizeof(*scontrol), GFP_KERNEL);
     if (!scontrol)
         return -ENOMEM;

     scontrol->name = kstrdup(hdr->name, GFP_KERNEL);
     if (!scontrol->name)
         return -ENOMEM;

Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Link: https://lore.kernel.org/r/20220318021616.2599630-1-liaoyu15@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c