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:
parent
8f56d64a1f
commit
2a73450818
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue