Skip to content

Commit 5ef0ed3

Browse files
ddustinrustyrussell
authored andcommitted
psbt: unused code path could leak
If `wally_psbt_extract` fails the function returns early leaking psbt, if it was `taken()`. Throw it on tmpctx so its not leaked in this case. Changelog-None
1 parent 9d77391 commit 5ef0ed3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bitcoin/tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ struct bitcoin_tx *bitcoin_tx_with_psbt(const tal_t *ctx, struct wally_psbt *psb
553553
size_t locktime;
554554

555555
if (!taken(psbt))
556-
psbt = clone_psbt(NULL, psbt);
556+
psbt = clone_psbt(tmpctx, psbt);
557557

558558
wally_psbt_get_locktime(psbt, &locktime);
559559
struct bitcoin_tx *tx = bitcoin_tx(ctx, chainparams,

0 commit comments

Comments
 (0)