calloc.cocci 310 B

12345678910111213141516
  1. // Use calloc or realloc as appropriate instead of multiply-and-alloc
  2. @malloc_to_calloc@
  3. identifier f =~ "(tor_malloc|tor_malloc_zero)";
  4. expression a;
  5. constant b;
  6. @@
  7. - f(a * b)
  8. + tor_calloc(a, b)
  9. @realloc_to_reallocarray@
  10. expression a, b;
  11. expression p;
  12. @@
  13. - tor_realloc(p, a * b)
  14. + tor_reallocarray(p, a, b)