Skip to contentSkip to conversation

ad1848 double free

PATCH Dave Jones 2 participants 2 messages Mar 6, 2006 Sound

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

Same again, snd_ctl_add() already kfree's on error.

Coverity #956

sound/isa/ad1848/ad1848_lib.c renamed from sound/isa/ad1848/ad1848_lib.c~ +1 -3
@@ -1202,10 +1202,8 @@ int snd_ad1848_add_ctl(struct snd_ad1848
 	strlcpy(ctl->id.name, name, sizeof(ctl->id.name));
 	ctl->id.index = index;
 	ctl->private_value = value;
-	if ((err = snd_ctl_add(chip->card, ctl)) < 0) {
-		snd_ctl_free_one(ctl);
+	if ((err = snd_ctl_add(chip->card, ctl)) < 0)
 		return err;
-	}
 	return 0;
 }
 
Signature · 1 line
http://www.codemonkey.org.uk
#1 lore raw

At Mon, 6 Mar 2006 03:58:18 -0500,

Quoted 9 lines · Dave Jones

Same again, snd_ctl_add() already kfree's on error.

Coverity #956

sound/isa/ad1848/ad1848_lib.c int snd_ad1848_add_ctl(struct snd_ad1848 · line 1208

Quoted 10 lines
sound/isa/ad1848/ad1848_lib.c renamed from sound/isa/ad1848/ad1848_lib.c~ +1 -3
@@ -1202,10 +1202,8 @@ int snd_ad1848_add_ctl(struct snd_ad1848
 	strlcpy(ctl->id.name, name, sizeof(ctl->id.name));
 	ctl->id.index = index;
 	ctl->private_value = value;
-	if ((err = snd_ctl_add(chip->card, ctl)) < 0) {
-		snd_ctl_free_one(ctl);
+	if ((err = snd_ctl_add(chip->card, ctl)) < 0)
 		return err;
-	}
 	return 0;
 }

Yep, both fixes for sb_mixer.c and ad1848_lib.c are correct. I also wanted to start fixing them since Andrew reported a similar bug in core/control.c, but you are much faster :) Thanks!

Takashi