Browse Source

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>
ppa-0.6.1
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
e098578731
  1. 8
      gossipd/gossip.c

8
gossipd/gossip.c

@ -650,10 +650,6 @@ static struct io_plan *peer_connected(struct io_conn *conn, struct peer *peer)
= 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. */
msg = towire_gossip_peer_connected(peer, &peer->id, &peer->addr,
&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))
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. */
wake_gossip_out(peer);

Loading…
Cancel
Save