mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
gossipd: fix use-after-free when we fail to make connection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4279e5cdbd
commit
f6ff89e596
@ -1865,6 +1865,8 @@ static bool nonlocal_dump_gossip(struct io_conn *conn, struct daemon_conn *dc)
|
||||
|
||||
static struct io_plan *new_peer_got_fd(struct io_conn *conn, struct peer *peer)
|
||||
{
|
||||
struct daemon *daemon = peer->daemon;
|
||||
|
||||
peer->local->conn = io_new_conn(conn, peer->local->fd,
|
||||
peer_start_gossip, peer);
|
||||
if (!peer->local->conn) {
|
||||
@ -1875,7 +1877,7 @@ static struct io_plan *new_peer_got_fd(struct io_conn *conn, struct peer *peer)
|
||||
/* If conn dies, we forget peer. */
|
||||
tal_steal(peer->local->conn, peer);
|
||||
}
|
||||
return daemon_conn_read_next(conn, &peer->daemon->master);
|
||||
return daemon_conn_read_next(conn, &daemon->master);
|
||||
}
|
||||
|
||||
/* This lets us read the fds in before handling anything. */
|
||||
|
Loading…
Reference in New Issue
Block a user