1
linux/sound
Julia Lawall d6f35e3f0d ALSA: sound/pci/pcxhr/pcxhr.c: introduce missing kfree and pci_disable_device
Error handling code following a kzalloc should free the allocated data.
The error handling code is adjusted to call pci_disable_device(pci); as
well, as done later in the function

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,l;
position p1,p2;
expression *ptr != NULL;
@@

(
if ((x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...)) == NULL) S
|
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
)
<... when != x
     when != if (...) { <+...x...+> }
x->f = E
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-15 19:07:29 +01:00
..
aoa sound: struct device - replace bus_id with dev_name(), dev_set_name() 2008-11-03 08:57:33 +01:00
arm ALSA: Ensure PXA runtime data is initialised 2008-10-22 17:22:01 +02:00
core ALSA: rawmidi - Add open check in rawmidi callbacks 2008-11-03 08:57:12 +01:00
drivers sound: struct device - replace bus_id with dev_name(), dev_set_name() 2008-11-03 08:57:33 +01:00
i2c ALSA: revo51: add headphone output 2008-08-25 09:57:17 +02:00
isa ALSA: gusextreme: Fix build errors 2008-11-10 07:54:25 +01:00
mips ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
oss sound: use a common working email address 2008-10-27 16:36:30 +01:00
parisc ALSA: harmony - fix a typo 2008-09-04 10:33:55 +02:00
pci ALSA: sound/pci/pcxhr/pcxhr.c: introduce missing kfree and pci_disable_device 2008-11-15 19:07:29 +01:00
pcmcia ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
ppc ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
sh ALSA: Fix section for snd-aica platform driver 2008-09-23 08:17:58 +02:00
soc sound: struct device - replace bus_id with dev_name(), dev_set_name() 2008-11-03 08:57:33 +01:00
sparc ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
spi sound: Convert to menuconfig 2008-05-27 15:56:20 +02:00
synth ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
usb ALSA: usb - Add quirk for Edirol UA-25EX advanced modes 2008-10-30 11:37:01 +01:00
ac97_bus.c [ALSA] ac97_bus power management 2007-02-09 09:03:54 +01:00
Kconfig sound: make OSS sound core optional 2008-08-29 10:06:21 +02:00
last.c [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
Makefile [ALSA] Add SPI devices to ALSA Kconfig and Makefile 2007-10-16 15:57:47 +02:00
sound_core.c sound: use a common working email address 2008-10-27 16:36:30 +01:00
sound_firmware.c Detach sched.h from mm.h 2007-05-21 09:18:19 -07:00