mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
gossipd: fix leak when we fail to dup fds.
In this case, peer would stay around, but conn would be freed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
f6ff89e596
commit
e098578731
@@ -650,10 +650,6 @@ static struct io_plan *peer_connected(struct io_conn *conn, struct peer *peer)
|
|||||||
= peer->daemon->rstate->broadcasts->next_index;
|
= peer->daemon->rstate->broadcasts->next_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a full peer now; we keep it around until master says
|
|
||||||
* it's dead. */
|
|
||||||
peer_finalized(peer);
|
|
||||||
|
|
||||||
/* We will not have anything queued, since we're not duplex. */
|
/* We will not have anything queued, since we're not duplex. */
|
||||||
msg = towire_gossip_peer_connected(peer, &peer->id, &peer->addr,
|
msg = towire_gossip_peer_connected(peer, &peer->id, &peer->addr,
|
||||||
&peer->local->pcs.cs,
|
&peer->local->pcs.cs,
|
||||||
@@ -661,6 +657,10 @@ static struct io_plan *peer_connected(struct io_conn *conn, struct peer *peer)
|
|||||||
if (!send_peer_with_fds(peer, msg))
|
if (!send_peer_with_fds(peer, msg))
|
||||||
return io_close(conn);
|
return io_close(conn);
|
||||||
|
|
||||||
|
/* This is a full peer now; we keep it around until master says
|
||||||
|
* it's dead. */
|
||||||
|
peer_finalized(peer);
|
||||||
|
|
||||||
/* Start the gossip flowing. */
|
/* Start the gossip flowing. */
|
||||||
wake_gossip_out(peer);
|
wake_gossip_out(peer);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user