From af7ed039214795faa9df861e472dc6d5f0a41be5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 7 Sep 2021 13:36:05 +0930 Subject: [PATCH] plugins/bcli: handle memleak. Signed-off-by: Rusty Russell --- plugins/bcli.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/bcli.c b/plugins/bcli.c index f3e9b16b0..f425e1d75 100644 --- a/plugins/bcli.c +++ b/plugins/bcli.c @@ -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.");