| 6 | static bool stealing; |
| 7 | |
| 8 | static void *failing_alloc(size_t len) |
| 9 | { |
| 10 | if (alloc_count++ == when_to_fail) |
| 11 | return NULL; |
| 12 | /* once we've failed once, it shouldn't ask again (steal can though). */ |
| 13 | assert(stealing || alloc_count <= when_to_fail); |
| 14 | |
| 15 | return malloc(len); |
| 16 | } |
| 17 | |
| 18 | static void *failing_realloc(void *p, size_t len) |
| 19 | { |
nothing calls this directly
no outgoing calls
no test coverage detected