diff options
author | Julia Lawall <julia@diku.dk> | 2010-04-02 08:47:59 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-04-04 06:21:42 -0400 |
commit | a0fd4345f928d72a56e27b23e4cd28c94bf36be5 (patch) | |
tree | c4eb9cbfebfb66bd68ab4070285f9f1920dd4627 /sound | |
parent | f11947c7c5b8abffd328739996dfdffef2b3e03f (diff) |
ALSA: echoaudio - Eliminate use after free
Use the call to snd_card_free in the error handling code at the end of the
function, as in the other error cases.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression E,E2;
@@
snd_card_free(E)
...
(
E = E2
|
* E
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/echoaudio/echoaudio.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 8dab82d7d19d..668a5ec04499 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -2184,10 +2184,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2184 | goto ctl_error; | 2184 | goto ctl_error; |
2185 | #endif | 2185 | #endif |
2186 | 2186 | ||
2187 | if ((err = snd_card_register(card)) < 0) { | 2187 | err = snd_card_register(card); |
2188 | snd_card_free(card); | 2188 | if (err < 0) |
2189 | goto ctl_error; | 2189 | goto ctl_error; |
2190 | } | ||
2191 | snd_printk(KERN_INFO "Card registered: %s\n", card->longname); | 2190 | snd_printk(KERN_INFO "Card registered: %s\n", card->longname); |
2192 | 2191 | ||
2193 | pci_set_drvdata(pci, chip); | 2192 | pci_set_drvdata(pci, chip); |