[alsa-devel] [bug report] ASoC: rsnd: call missing snd_ctl_remove()
Hello Kuninori Morimoto,
The patch d1f83d6ef43b: "ASoC: rsnd: call missing snd_ctl_remove()" from Feb 2, 2015, leads to the following static checker warning:
sound/soc/sh/rcar/core.c:1034 __rsnd_kctrl_new() error: double free of 'kctrl'
sound/soc/sh/rcar/core.c 1026 int ret; 1027 1028 kctrl = snd_ctl_new1(&knew, mod); 1029 if (!kctrl) 1030 return -ENOMEM; 1031 1032 ret = snd_ctl_add(card, kctrl); 1033 if (ret < 0) { 1034 snd_ctl_free_one(kctrl);
The snd_ctl_add() function frees kctrl on error. It's a confusing layering violation IMHO but there are a lot of callers so I'm too lazy to clean this up myself...
1035 return ret; 1036 } 1037
regards, dan carpenter
Hi Dan
Thank you for reporting about this. I think this issue was solved by this patch which is in mark/fix/rcar
0ea617a298dcdc2251b4e10f83ac3f3e627b66e3 ("ASoC: rsnd: don't double free kctrl")
The patch d1f83d6ef43b: "ASoC: rsnd: call missing snd_ctl_remove()" from Feb 2, 2015, leads to the following static checker warning:
sound/soc/sh/rcar/core.c:1034 __rsnd_kctrl_new() error: double free of 'kctrl'
sound/soc/sh/rcar/core.c 1026 int ret; 1027 1028 kctrl = snd_ctl_new1(&knew, mod); 1029 if (!kctrl) 1030 return -ENOMEM; 1031 1032 ret = snd_ctl_add(card, kctrl); 1033 if (ret < 0) { 1034 snd_ctl_free_one(kctrl);
The snd_ctl_add() function frees kctrl on error. It's a confusing layering violation IMHO but there are a lot of callers so I'm too lazy to clean this up myself...
1035 return ret; 1036 } 1037
regards, dan carpenter
participants (2)
-
Dan Carpenter
-
Kuninori Morimoto