kfreeaddr.cocci 583 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /// Free of a structure field
  2. ///
  3. // Confidence: High
  4. // Copyright: (C) 2013 Julia Lawall, INRIA/LIP6. GPLv2.
  5. // URL: http://coccinelle.lip6.fr/
  6. // Comments:
  7. // Options: --no-includes --include-headers
  8. virtual org
  9. virtual report
  10. virtual context
  11. @r depends on context || report || org @
  12. expression e;
  13. identifier f;
  14. position p;
  15. @@
  16. (
  17. * kfree@p(&e->f)
  18. |
  19. * kzfree@p(&e->f)
  20. )
  21. @script:python depends on org@
  22. p << r.p;
  23. @@
  24. cocci.print_main("kfree",p)
  25. @script:python depends on report@
  26. p << r.p;
  27. @@
  28. msg = "ERROR: invalid free of structure field"
  29. coccilib.report.print_report(p[0],msg)