Skip to content

Commit 98619a0

Browse files
committed
wallet: fix erroneous allocation of db_col_optional_scid.
We are supposed to allocate of the ctx we're passed, not tmpctx. Doesn't matter for now, because we don't use this result with anything which outlives tmpctx, but we're going to: ``` ==47574==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040005a8f38 at pc 0x55d3c584d252 bp 0x7ffddfb1b090 sp 0x7ffddfb1b088 READ of size 8 at 0x6040005a8f38 thread T0 #0 0x55d3c584d251 in json_add_closed_channel /home/runner/work/lightning/lightning/lightningd/closed_channel.c:27:3 #1 0x55d3c584ca5a in json_listclosedchannels /home/runner/work/lightning/lightning/lightningd/closed_channel.c:118:3 #2 0x55d3c58c0cbe in command_exec /home/runner/work/lightning/lightning/lightningd/jsonrpc.c:808:8 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 6bf3691 commit 98619a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wallet/wallet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ static struct short_channel_id *db_col_optional_scid(const tal_t *ctx,
16721672
if (db_col_is_null(stmt, colname))
16731673
return NULL;
16741674

1675-
scid = tal(tmpctx, struct short_channel_id);
1675+
scid = tal(ctx, struct short_channel_id);
16761676
*scid = db_col_short_channel_id(stmt, colname);
16771677
return scid;
16781678
}

0 commit comments

Comments
 (0)