plugins/bcli: handle memleak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-09-07 13:36:05 +09:30 committed by Christian Decker
parent b82e5be6e1
commit af7ed03921

View file

@ -851,6 +851,13 @@ static void wait_and_check_bitcoind(struct plugin *p)
tal_free(cmd);
}
#if DEVELOPER
static void memleak_mark_bitcoind(struct plugin *p, struct htable *memtable)
{
memleak_remove_region(memtable, bitcoind, sizeof(*bitcoind));
}
#endif
static const char *init(struct plugin *p, const char *buffer UNUSED,
const jsmntok_t *config UNUSED)
{
@ -862,6 +869,9 @@ static const char *init(struct plugin *p, const char *buffer UNUSED,
else
bitcoind->fake_fees = false;
#if DEVELOPER
plugin_set_memleak_handler(p, memleak_mark_bitcoind);
#endif
plugin_log(p, LOG_INFORM,
"bitcoin-cli initialized and connected to bitcoind.");