gossipd: fix take leak when peer is dying.

In this case, local and remote are *both* NULL; so if someone tries to
send a packet with take(), we need to free it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-06-14 12:29:33 +09:30 committed by Christian Decker
parent a7e6cdb418
commit 5c19c55841

View file

@ -506,6 +506,9 @@ static void queue_peer_msg(struct peer *peer, const u8 *msg TAKES)
if (taken(msg))
tal_free(msg);
daemon_conn_send(peer->remote, take(send));
} else { /* Waiting to die. */
if (taken(msg))
tal_free(msg);
}
}