From 795a03e8c4ae4d5102862dc3e086da7791ed7901 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Dec 2017 20:52:57 +1030 Subject: [PATCH] fromwire_bitcoin_tx: quieten leak reporting. We create a temporary tx which is a child of the real tx, for simplicity of marshalling. That's OK. Signed-off-by: Rusty Russell --- channeld/Makefile | 1 + closingd/Makefile | 1 + common/htlc_wire.c | 6 +++++- onchaind/Makefile | 1 + openingd/Makefile | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/channeld/Makefile b/channeld/Makefile index 169bf7a45..40ebd139a 100644 --- a/channeld/Makefile +++ b/channeld/Makefile @@ -49,6 +49,7 @@ CHANNELD_COMMON_OBJS := \ common/io_debug.o \ common/keyset.o \ common/key_derive.o \ + common/memleak.o \ common/msg_queue.o \ common/ping.o \ common/peer_failed.o \ diff --git a/closingd/Makefile b/closingd/Makefile index 6cccb1a7c..aa58aa2d5 100644 --- a/closingd/Makefile +++ b/closingd/Makefile @@ -51,6 +51,7 @@ CLOSINGD_COMMON_OBJS := \ common/dev_disconnect.o \ common/derive_basepoints.o \ common/htlc_wire.o \ + common/memleak.o \ common/msg_queue.o \ common/peer_failed.o \ common/permute_tx.o \ diff --git a/common/htlc_wire.c b/common/htlc_wire.c index c6c5083a9..a3077400e 100644 --- a/common/htlc_wire.c +++ b/common/htlc_wire.c @@ -2,6 +2,7 @@ #include #include #include +#include #include /* FIXME: We could adapt tools/generate-wire.py to generate structures @@ -147,6 +148,9 @@ void fromwire_bitcoin_tx(const u8 **cursor, size_t *max, struct bitcoin_tx *tx) * for the sake of simple structures, we don't write the * generator that way. */ struct bitcoin_tx *tx2 = pull_bitcoin_tx(tx, cursor, max); - if (tx2) + if (tx2) { *tx = *tx2; + /* This hangs around with tx until freed */ + notleak(tx2); + } } diff --git a/onchaind/Makefile b/onchaind/Makefile index 1cf09e2e2..604dea7c5 100644 --- a/onchaind/Makefile +++ b/onchaind/Makefile @@ -56,6 +56,7 @@ ONCHAIND_COMMON_OBJS := \ common/initial_commit_tx.o \ common/keyset.o \ common/key_derive.o \ + common/memleak.o \ common/msg_queue.o \ common/permute_tx.o \ common/status.o \ diff --git a/openingd/Makefile b/openingd/Makefile index 6575478c8..96509b106 100644 --- a/openingd/Makefile +++ b/openingd/Makefile @@ -50,6 +50,7 @@ OPENINGD_COMMON_OBJS := \ common/initial_commit_tx.o \ common/key_derive.o \ common/keyset.o \ + common/memleak.o \ common/msg_queue.o \ common/ping.o \ common/peer_failed.o \