| 1339 | } |
| 1340 | |
| 1341 | static 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? */ |
no test coverage detected