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
34 f(...,c,...,(T)E@p,...)
70 expression free.E, subE<=free.E, E2;
74 position free.p1!=loop.ok,p2!={print.p,sz.p};
80 iter(...,subE,...) S // no use
82 list_remove_head(E1,subE,...)
102 return_ACPI_STATUS(...)
107 @script:python depends on org@
112 cocci.print_main("kfree",p1)
113 cocci.print_secs("ref",p2)
115 @script:python depends on report@
120 msg = "ERROR: reference preceded by free on line %s" % (p1[0].line)
121 coccilib.report.print_report(p2[0],msg)