lightningd: fix fd leak with check command on openchannel_init.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-29 10:04:15 +10:30
parent 45b298fca4
commit 5a1e511a85

View file

@ -3133,15 +3133,15 @@ static struct command_result *json_openchannel_init(struct command *cmd,
type_to_string(tmpctx, struct wally_psbt,
psbt));
if (command_check_only(cmd))
return command_check_done(cmd);
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) != 0) {
return command_fail(cmd, FUND_MAX_EXCEEDED,
"Failed to create socketpair: %s",
strerror(errno));
}
if (command_check_only(cmd))
return command_check_done(cmd);
/* Now we can't fail, create channel */
channel = new_unsaved_channel(peer,
peer->ld->config.fee_base,