connectd: fix leak of peer.

We no longer need to keep 'struct peer' around: we free it as soon as
we hand off to the master daemon.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-08-16 09:46:07 +09:30 committed by Christian Decker
parent 8f56d64a1f
commit 2a73450818
1 changed files with 3 additions and 3 deletions

View File

@ -158,6 +158,8 @@ struct reaching {
u32 seconds_waited;
};
/* This is a transitory structure: we hand off to the master daemon as soon
* as we've completed INIT read/write. */
struct peer {
struct daemon *daemon;
@ -382,9 +384,7 @@ static struct io_plan *peer_connected(struct io_conn *conn, struct peer *peer)
pubkey_set_add(&daemon->peers,
tal_dup(daemon, struct pubkey, &peer->id));
/* We keep peer around until master says peer_disconnected */
tal_steal(daemon, peer);
/* This frees the peer. */
return io_close_taken_fd(conn);
}