Skip to contentSkip to conversation

au88x0: mem leak fix in snd_vortex_create()

PATCH Applied Jesper Juhl 3 participants 3 messages Aug 4, 2007 – Aug 6, 2007 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 au88x0: mem leak fix in snd_vortex_create()

Hi,

In sound/pci/au88x0/au88x0.c::snd_vortex_create() :
The Coverity checker found that if we allocate storage for 'chip' but then leave via the regions_out: label, then we end up leaking the storage allocated for 'chip'.
I believe simply freeing 'chip' before the "return err;" line is all we need to fix this, but please double-check me :)

---

sound/pci/au88x0/au88x0.c +1 -0
index 5ec1b6f..f70286a 100644
@@ -232,6 +232,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 	pci_disable_device(chip->pci_dev);
 	//FIXME: this not the right place to unregister the gameport
 	vortex_gameport_unregister(chip);
+	kfree(chip);
 	return err;
 }
 
#1 lore raw
Quoted 16 lines · Jesper Juhl

In sound/pci/au88x0/au88x0.c::snd_vortex_create() :
The Coverity checker found that if we allocate storage for 'chip' but then leave via the regions_out: label, then we end up leaking the storage allocated for 'chip'.
I believe simply freeing 'chip' before the "return err;" line is all we need to fix this, but please double-check me :)

---

sound/pci/au88x0/au88x0.c +0 -0
index 5ec1b6f..f70286a 100644

sound/pci/au88x0/au88x0.c snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) · line 237

Quoted 6 lines
sound/pci/au88x0/au88x0.c +1 -0
@@ -232,6 +232,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 	pci_disable_device(chip->pci_dev);
 	//FIXME: this not the right place to unregister the gameport
 	vortex_gameport_unregister(chip);
+	kfree(chip);
 	return err;
 }

ACK.

Rene.

Applied
#2 lore raw
In reply to Jesper Juhl

At Sat, 4 Aug 2007 02:09:25 +0200,

Quoted 11 lines · Jesper Juhl

Hi,

In sound/pci/au88x0/au88x0.c::snd_vortex_create() :
The Coverity checker found that if we allocate storage for 'chip' but then leave via the regions_out: label, then we end up leaking the storage allocated for 'chip'.
I believe simply freeing 'chip' before the "return err;" line is all we need to fix this, but please double-check me :)

Quoted 1 line

Thanks, applied to ALSA tree now.

Takashi