Browse Source

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 <rusty@rustcorp.com.au>
htlc_accepted_hook
Rusty Russell 6 years ago
parent
commit
ffa84637ea
  1. 3
      common/utxo.c

3
common/utxo.c

@ -1,5 +1,6 @@
#include <bitcoin/script.h> #include <bitcoin/script.h>
#include <common/key_derive.h> #include <common/key_derive.h>
#include <common/utils.h>
#include <common/utxo.h> #include <common/utxo.h>
#include <wire/wire.h> #include <wire/wire.h>
@ -60,7 +61,7 @@ struct bitcoin_tx *tx_spending_utxos(const tal_t *ctx,
for (size_t i = 0; i < tal_count(utxos); i++) { for (size_t i = 0; i < tal_count(utxos); i++) {
if (utxos[i]->is_p2sh && bip32_base) { if (utxos[i]->is_p2sh && bip32_base) {
bip32_pubkey(bip32_base, &key, utxos[i]->keyindex); bip32_pubkey(bip32_base, &key, utxos[i]->keyindex);
script = bitcoin_scriptsig_p2sh_p2wpkh(tx, &key); script = bitcoin_scriptsig_p2sh_p2wpkh(tmpctx, &key);
} else { } else {
script = NULL; script = NULL;
} }

Loading…
Cancel
Save