Julia Lawall
a809dda036
HID: fix memory leak on error patch in debug code
Error handling code following a kzalloc should free the allocated data.
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,f1,l;
position p1,p2;
expression *ptr != NULL;
@@
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
when != if (...) { <+...x...+> }
(
x->f1 = E
|
(x->f1 == NULL || ...)
|
f(...,x->f1,...)
)
...>
(
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>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-08 02:26:10 +02:00
..
2009-06-10 15:25:41 -07:00
2009-06-11 11:23:17 -07:00
2009-04-13 15:04:33 -07:00
2009-05-28 14:24:07 -07:00
2009-06-10 23:07:16 +02:00
2009-06-11 08:51:05 -07:00
2009-05-22 23:22:54 +02:00
2009-06-11 14:15:57 -07:00
2009-05-03 18:05:42 +09:00
2009-06-09 22:30:27 +09:30
2009-05-17 15:48:05 -07:00
2009-05-30 07:57:44 -07:00
2009-06-10 12:19:41 +02:00
2009-06-10 11:05:00 -04:00
2009-06-05 10:21:52 -07:00
2009-08-08 02:26:10 +02:00
2009-06-01 13:46:49 +02:00
2009-05-26 23:50:40 +09:00
2009-06-11 11:10:35 -07:00
2009-05-28 20:52:40 -04:00
2009-06-11 21:36:09 -04:00
2009-05-13 16:31:12 -07:00
2009-05-29 08:48:25 -07:00
2009-05-21 15:04:15 -07:00
2009-04-08 14:13:48 +01:00
2009-05-26 12:13:11 -07:00
2009-04-24 08:16:05 -07:00
2009-06-11 11:10:35 -07:00
2009-06-05 08:05:23 -07:00
2009-05-22 23:22:54 +02:00
2009-05-22 23:22:54 +02:00
2009-05-19 22:22:28 +02:00
2009-05-15 12:20:57 -04:00
2009-06-11 11:10:35 -07:00
2009-06-11 11:10:35 -07:00
2009-06-09 04:01:02 -07:00
2009-05-07 17:28:59 +02:00
2009-04-28 12:21:16 +02:00
2009-06-11 08:51:03 -07:00
2009-06-10 15:25:41 -07:00
2009-04-23 23:25:40 +01:00
2009-05-14 11:28:27 -04:00
2009-06-01 21:06:21 +02:00
2009-04-08 17:45:02 -07:00
2009-04-07 08:31:11 -07:00
2009-05-18 11:21:10 +01:00
2009-05-22 13:29:37 +09:00
2009-05-22 23:22:54 +02:00
2009-05-11 09:52:18 +02:00
2009-06-11 11:10:35 -07:00
2009-06-11 10:08:33 -07:00
2009-06-11 10:33:09 +03:00
2009-04-07 08:31:10 -07:00
2009-05-12 14:11:34 -07:00
2009-06-08 16:57:50 +01:00
2009-05-08 19:39:28 -07:00
2009-05-14 13:40:53 -04:00
2009-04-16 16:17:11 -07:00
2009-06-11 21:36:11 -04:00
2009-04-07 08:31:11 -07:00
2009-06-11 12:25:06 -07:00
2009-04-19 23:14:01 +09:30
2009-04-23 23:25:41 +01:00
2009-06-10 16:16:27 -07:00
2009-04-29 15:41:13 -03:00