Skip to content

Commit

Permalink
common/utxo: don't memleak script.
Browse files Browse the repository at this point in the history
We currently always free the tx, so we didn't notice, but the coming
changes uncovered this leak.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 6, 2019
1 parent 0543149 commit ffa8463
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/utxo.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <bitcoin/script.h>
#include <common/key_derive.h>
#include <common/utils.h>
#include <common/utxo.h>
#include <wire/wire.h>

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ffa8463

Please sign in to comment.