Replace all calls to malloc, calloc, realloc with safe versions
As decided in the community meeting at Frauenchiemsee 2025, we should not assume anymore that memory allocations always succeed.
This MR prepares the benchmark set for this rule change: Every memory allocation is guarded by an assumption that it succeeded (and aborts the program otherwise).
All calls to malloc, calloc, and realloc are replaced with calls to safe_malloc, safe_calloc, and safe_realloc, respectively.
These are defined as follows:
void *safe_malloc(size_t size) {
void *p = malloc(size);
if (p == 0) {
abort();
}
return p;
}
void *safe_calloc(size_t num, size_t size) {
void *p = calloc(num, size);
if (p == 0) {
abort();
}
return p;
}
void *safe_realloc(void *ptr, size_t size) {
void *p = realloc(ptr, size);
if (p == 0) {
abort();
}
return p;
}