mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +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:
committed by
Christian Decker
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)
|
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->local->conn = io_new_conn(conn, peer->local->fd,
|
||||||
peer_start_gossip, peer);
|
peer_start_gossip, peer);
|
||||||
if (!peer->local->conn) {
|
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. */
|
/* If conn dies, we forget peer. */
|
||||||
tal_steal(peer->local->conn, 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. */
|
/* This lets us read the fds in before handling anything. */
|
||||||
|
|||||||
Reference in New Issue
Block a user