| 71 | } |
| 72 | |
| 73 | void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line) |
| 74 | { |
| 75 | if (num >= max_alloc/size) { |
| 76 | if (!file) |
| 77 | return NULL; |
| 78 | rprintf(FERROR, "[%s] exceeded --max-alloc=%s setting (file=%s, line=%d)\n", |
| 79 | who_am_i(), do_big_num(max_alloc, 0, NULL), src_file(file), line); |
| 80 | exit_cleanup(RERR_MALLOC); |
| 81 | } |
| 82 | if (!ptr) |
| 83 | ptr = malloc(num * size); |
| 84 | else if (ptr == do_calloc) |
| 85 | ptr = calloc(num, size); |
| 86 | else |
| 87 | ptr = realloc(ptr, num * size); |
| 88 | if (!ptr && file) |
| 89 | _out_of_memory("my_alloc caller", file, line); |
| 90 | return ptr; |
| 91 | } |
| 92 | |
| 93 | const char *sum_as_hex(int csum_type, const char *sum, int flist_csum) |
| 94 | { |
no test coverage detected