1 /// Find a use after free.
2 //# Values of variables may imply that some
3 //# execution paths are not possible, resulting in false positives.
4 //# Another source of false positives are macros such as
5 //# SCTP_DBG_OBJCNT_DEC that do not actually evaluate their argument
7 // Confidence: Moderate
8 // Copyright: (C) 2010-2012 Nicolas Palix. GPLv2.
9 // Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2.
10 // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2.
11 // URL: http://coccinelle.lip6.fr/
13 // Options: --no-includes --include-headers
38 f(...,c,...,(T)E@p,...)
78 expression free.E, subE<=free.E, E2;
82 position free.p1!=loop.ok,p2!={print.p,sz.p};
92 iter(...,subE,...) S // no use
94 list_remove_head(E1,subE,...)
114 return_ACPI_STATUS(...)
119 @script:python depends on org@
124 cocci.print_main("kfree",p1)
125 cocci.print_secs("ref",p2)
127 @script:python depends on report@
132 msg = "ERROR: reference preceded by free on line %s" % (p1[0].line)
133 coccilib.report.print_report(p2[0],msg)