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-07-12 12:57:54 -07:00
2010-07-12 12:57:54 -07:00
2010-02-22 16:20:22 -08: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-07-08 21:35:58 -07:00
2010-06-28 23:24:29 -07:00
2010-02-22 16:20:22 -08:00
2010-06-10 23:31:35 -07:00
2008-10-07 08:38:24 +11: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
2009-03-02 03:00:15 -08:00
2009-03-02 03:00:15 -08:00
2009-05-25 22:44:59 -07:00
2010-07-12 12:57:54 -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