Skip to content

Commit e88f3fb

Browse files
Colin Ian Kinggregkh
authored andcommitted
ASoC: rsnd: don't double free kctrl
[ Upstream commit 0ea617a298dcdc2251b4e10f83ac3f3e627b66e3 ] On an error, snd_ctl_add already free's kctrl, so calling snd_ctl_free_one to free it again leads to a double free error. Fix this by removing the extraneous snd_ctl_free_one call. Issue found using static analysis with CoverityScan, CID 1372908 Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 47b99a3 commit e88f3fb

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

sound/soc/sh/rcar/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,8 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
10491049
return -ENOMEM;
10501050

10511051
ret = snd_ctl_add(card, kctrl);
1052-
if (ret < 0) {
1053-
snd_ctl_free_one(kctrl);
1052+
if (ret < 0)
10541053
return ret;
1055-
}
10561054

10571055
cfg->update = update;
10581056
cfg->card = card;

0 commit comments

Comments
 (0)