Julia Lawall
e2bde78713
mfd: Fix davinci memory leak
Error handling code following a kmalloc 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>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-08-12 11:27:20 +02:00
..
2010-08-07 17:08:30 -07:00
2010-07-31 13:07:27 +01:00
2010-08-11 09:13:19 -07:00
2010-08-09 21:05:52 -07:00
2010-08-09 20:45:02 -07:00
2010-08-10 15:22:42 -07:00
2010-08-06 12:25:06 -07:00
2010-08-07 18:25:34 +02:00
2010-08-11 08:59:23 -07:00
2010-08-03 13:47:05 -04:00
2010-08-09 20:45:04 -07:00
2010-08-11 09:17:27 -07:00
2010-08-10 23:17:52 +01:00
2010-08-11 08:59:21 -07:00
2010-08-02 10:09:04 +02:00
2010-08-09 20:45:09 -07:00
2010-08-11 08:59:09 -07:00
2010-08-10 13:47:40 -07:00
2010-08-10 15:08:02 -07:00
2010-08-11 08:58:59 -07:00
2010-08-09 14:07:19 +01:00
2010-08-10 15:22:42 -07:00
2010-08-04 11:13:36 -07:00
2010-08-02 10:09:04 +02:00
2010-08-07 23:08:47 -07:00
2010-08-11 08:59:22 -07:00
2010-08-09 21:05:52 -07:00
2010-08-05 13:53:35 -07:00
2010-08-06 13:25:43 -07:00
2010-08-10 15:38:19 -07:00
2010-08-10 15:09:54 -07:00
2010-08-07 18:25:34 +02:00
2010-08-11 08:59:12 -07:00
2010-08-12 11:27:20 +02:00
2010-08-11 08:59:20 -07:00
2010-08-11 08:59:05 -07:00
2010-08-11 08:59:18 -07:00
2010-08-11 09:17:27 -07:00
2010-08-01 01:44:18 -06:00
2010-08-04 15:31:02 -07:00
2010-08-11 08:59:22 -07:00
2010-08-09 21:00:07 -07:00
2010-08-10 23:17:52 +01:00
2010-08-03 11:55:15 -04:00
2010-08-11 09:13:19 -07:00
2010-08-05 13:53:35 -07:00
2010-08-11 09:13:19 -07:00
2010-08-10 15:22:42 -07:00
2010-08-05 15:57:35 -07:00
2010-08-11 08:59:21 -07:00
2010-08-11 09:13:19 -07:00
2010-08-04 16:12:01 +09:00
2010-08-01 01:42:42 -06:00
2010-08-06 12:25:06 -07:00
2010-08-10 15:22:42 -07:00
2010-08-03 09:04:11 +02:00
2010-08-05 13:53:33 -07:00
2010-08-10 15:05:02 -07:00
2010-08-04 11:47:58 -07:00
2010-08-11 09:18:06 -07:00
2010-08-08 18:22:44 +00:00
2010-08-10 15:22:42 -07:00
2010-08-09 21:14:08 +02:00