From 2a73450818c1000936004dfabeef79ee69b4920d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 16 Aug 2018 09:46:07 +0930 Subject: [PATCH] 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 --- connectd/connect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connectd/connect.c b/connectd/connect.c index cce4219ec..ef94128be 100644 --- a/connectd/connect.c +++ b/connectd/connect.c @@ -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); }