realloc.cocci 301 B

12345678910111213141516171819
  1. @realloc@
  2. expression x, E;
  3. type ty;
  4. position p1;
  5. @@
  6. (
  7. x@p1 = SCRealloc(x, E)
  8. |
  9. x@p1 = (ty *) SCRealloc(x, E)
  10. )
  11. @script:python@
  12. p1 << realloc.p1;
  13. @@
  14. print("Structure reallocated at %s:%s but original pointer is lost and not freed in case of error." % (p1[0].file, p1[0].line))
  15. import sys
  16. sys.exit(1)