Julia Lawall
c34186ed00
net/ipv4: Eliminate kstrdup memory leak
...
The string clone is only used as a temporary copy of the argument val
within the while loop, and so it should be freed before leaving the
function. The call to strsep, however, modifies clone, so a pointer to the
front of the string is kept in saved_clone, to make it possible to free it.
The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/ )
// <smpl>
@r exists@
local idexpression x;
expression E;
identifier l;
statement S;
@@
*x= \(kasprintf\|kstrdup\)(...);
...
if (x == NULL) S
... when != kfree(x)
when != E = x
if (...) {
<... when != kfree(x)
* goto l;
...>
* return ...;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk >
Signed-off-by: David S. Miller <davem@davemloft.net >
2010-08-27 19:31:56 -07:00
..
2010-08-23 14:41:22 -07:00
2010-07-12 20:21:46 -07:00
2010-03-30 22:02:32 +09:00
2010-07-12 12:57:54 -07:00
2010-05-17 23:23:14 -07:00
2010-07-12 12:57:54 -07:00
2010-05-31 00:27:44 -07:00
2010-02-22 16:20:22 -08:00
2010-07-12 12:57:54 -07:00
2010-03-30 22:02:32 +09:00
2009-05-18 15:16:37 -07:00
2010-04-26 16:13:54 +02:00
2010-03-30 22:02:32 +09:00
2010-05-17 23:23:14 -07:00
2010-07-12 12:57:54 -07:00
2010-07-12 12:57:54 -07:00
2010-07-12 12:57:54 -07:00
2010-03-30 22:02:32 +09:00
2010-07-12 12:57:54 -07:00
2010-07-12 12:57:54 -07:00
2009-11-23 10:41:23 -08:00
2010-03-30 22:02:32 +09:00
2010-06-16 11:55:39 -07:00
2010-06-10 23:31:35 -07:00
2010-07-12 12:57:54 -07:00
2010-07-08 21:35:58 -07:00
2010-06-28 23:24:29 -07:00
2010-05-17 23:23:14 -07:00
2010-08-02 17:25:07 -07:00
2010-06-23 13:16:38 -07:00
2010-02-22 16:20:22 -08:00
2010-06-02 07:05:03 -07:00
2010-06-10 23:31:35 -07:00
2010-07-20 18:25:24 -07:00
2010-06-04 15:56:01 -07:00
2008-10-07 08:38:24 +11:00
2010-06-15 17:31:06 +02:00
2010-06-30 13:31:19 -07:00
2010-07-12 12:57:54 -07:00
2010-06-10 23:31:35 -07:00
2010-07-22 13:46:21 -07:00
2010-06-26 22:00:03 -07:00
2010-05-15 23:28:40 -07:00
2009-03-02 03:00:15 -08:00
2010-08-27 19:31:56 -07:00
2009-03-02 03:00:15 -08:00
2009-12-03 16:06:13 -08:00
2008-01-28 14:55:41 -08:00
2009-11-23 10:41:23 -08:00
2010-06-02 07:15:48 -07:00
2008-01-28 14:55:41 -08:00
2010-08-07 20:24:28 -07:00
2010-07-12 20:21:46 -07:00
2009-11-23 10:41:23 -08:00
2010-07-12 12:57:54 -07:00
2010-07-20 18:25:24 -07:00
2010-03-30 22:02:32 +09:00
2009-03-02 03:00:15 -08:00
2010-08-25 02:27:49 -07:00
2009-05-25 22:44:59 -07:00
2007-07-31 02:27:57 -07:00
2009-11-23 10:41:23 -08:00
2007-07-31 02:27:57 -07:00
2009-11-23 10:41:23 -08:00
2010-08-25 23:02:48 -07:00
2010-07-12 12:57:54 -07:00
2009-09-30 16:12:20 -07:00
2010-06-10 23:31:35 -07:00
2010-07-12 12:57:54 -07:00
2010-07-12 12:57:54 -07:00
2008-08-06 02:39:30 -07:00
2007-10-10 16:55:54 -07:00
2010-03-30 22:02:32 +09:00
2010-03-25 16:00:30 +01:00
2010-07-07 15:59:38 -07:00
2008-11-25 01:05:54 -08:00
2008-01-31 19:27:24 -08:00