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

Function handle_dev_memleak

openingd/openingd.c:1341–1359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339}
1340
1341static void handle_dev_memleak(struct state *state, const u8 *msg)
1342{
1343 struct htable *memtable;
1344 bool found_leak;
1345
1346 /* Populate a hash table with all our allocations (except msg, which
1347 * is in use right now). */
1348 memtable = memleak_start(tmpctx);
1349 memleak_ptr(memtable, msg);
1350
1351 /* Now delete state and things it has pointers to. */
1352 memleak_scan_obj(memtable, state);
1353
1354 /* If there's anything left, dump it to logs, and return true. */
1355 found_leak = dump_memleak(memtable, memleak_status_broken, NULL);
1356 wire_sync_write(REQ_FD,
1357 take(towire_openingd_dev_memleak_reply(NULL,
1358 found_leak)));
1359}
1360
1361/* Standard lightningd-fd-is-ready-to-read demux code. Again, we could hang
1362 * here, but if we can't trust our parent, who can we trust? */

Callers 1

handle_master_inFunction · 0.70

Calls 4

memleak_startFunction · 0.50
memleak_ptrFunction · 0.50
memleak_scan_objFunction · 0.50
wire_sync_writeFunction · 0.50

Tested by

no test coverage detected