| 77 | } |
| 78 | |
| 79 | static void *do_xmallocz(size_t size, int gentle) |
| 80 | { |
| 81 | void *ret; |
| 82 | if (unsigned_add_overflows(size, 1)) { |
| 83 | if (gentle) { |
| 84 | error("Data too large to fit into virtual memory space."); |
| 85 | return NULL; |
| 86 | } else |
| 87 | die("Data too large to fit into virtual memory space."); |
| 88 | } |
| 89 | ret = do_xmalloc(size + 1, gentle); |
| 90 | if (ret) |
| 91 | ((char*)ret)[size] = 0; |
| 92 | return ret; |
| 93 | } |
| 94 | |
| 95 | void *xmallocz(size_t size) |
| 96 | { |
no test coverage detected