calloc.cocci 350 B

1234567891011121314151617181920
  1. // Use calloc or realloc as appropriate instead of multiply-and-alloc
  2. @malloc_to_calloc@
  3. expression a,b;
  4. @@
  5. - tor_malloc(a * b)
  6. + tor_calloc(a, b)
  7. @malloc_zero_to_calloc@
  8. expression a, b;
  9. @@
  10. - tor_malloc_zero(a * b)
  11. + tor_calloc(a, b)
  12. @realloc_to_reallocarray@
  13. expression a, b;
  14. expression p;
  15. @@
  16. - tor_realloc(p, a * b)
  17. + tor_reallocarray(p, a, b)