calloc.cocci 301 B

123456789101112131415
  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, b;
  5. @@
  6. - f(a * b)
  7. + tor_calloc(a, b)
  8. @realloc_to_reallocarray@
  9. expression a, b;
  10. expression p;
  11. @@
  12. - tor_realloc(p, a * b)
  13. + tor_reallocarray(p, a, b)