MCPcopy Create free account
hub / github.com/ElementsProject/lightning / failing_alloc

Function failing_alloc

ccan/ccan/tal/test/run-allocfail.c:8–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6static bool stealing;
7
8static 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
18static void *failing_realloc(void *p, size_t len)
19{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected