1 /// Find a use after free. Values of variables may imply that some
2 /// execution paths are not possible, resulting in false positives.
3 /// Another source of false positives are macros such as
4 /// SCTP_DBG_OBJCNT_DEC that do not actually evaluate their argument
6 // Confidence: Moderate
7 // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
8 // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
9 // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
10 // URL: http://coccinelle.lip6.fr/
12 // Options: -no_includes -include_headers
33 f(...,c,...,(T)E@p,...)
65 expression free.E, subE<=free.E, E2;
69 position free.p1!=loop.ok,p2!={print.p,sz.p};
75 iter(...,subE,...) S // no use
77 list_remove_head(E1,subE,...)
97 return_ACPI_STATUS(...)
102 @script:python depends on org@
107 cocci.print_main("kfree",p1)
108 cocci.print_secs("ref",p2)
110 @script:python depends on report@
115 msg = "reference preceded by free on line %s" % (p1[0].line)
116 coccilib.report.print_report(p2[0],msg)