From ffa84637ea1685cbb96d0deb935e898afa772d1f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 5 Jun 2019 14:59:08 +0930 Subject: [PATCH] common/utxo: don't memleak script. We currently always free the tx, so we didn't notice, but the coming changes uncovered this leak. Signed-off-by: Rusty Russell --- common/utxo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/utxo.c b/common/utxo.c index 6dd7e9198..b80224f4f 100644 --- a/common/utxo.c +++ b/common/utxo.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -60,7 +61,7 @@ struct bitcoin_tx *tx_spending_utxos(const tal_t *ctx, for (size_t i = 0; i < tal_count(utxos); i++) { if (utxos[i]->is_p2sh && bip32_base) { bip32_pubkey(bip32_base, &key, utxos[i]->keyindex); - script = bitcoin_scriptsig_p2sh_p2wpkh(tx, &key); + script = bitcoin_scriptsig_p2sh_p2wpkh(tmpctx, &key); } else { script = NULL; }