mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
lightningd: fix crash when old openingd still around.
We weren't killing it. Eventually it would die, and peer_owner_finished() would access subd->peer->owner, but that peer was freed already. Closes: #261 Reported-by: Christian Decker <decker.christian@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
5889ad5fc4
commit
b19a4516d4
@@ -454,6 +454,7 @@ static bool peer_reconnected(struct lightningd *ld,
|
||||
int fd,
|
||||
const struct crypto_state *cs)
|
||||
{
|
||||
struct subd *subd;
|
||||
struct peer *peer = peer_by_id(ld, id);
|
||||
if (!peer)
|
||||
return false;
|
||||
@@ -495,8 +496,9 @@ static bool peer_reconnected(struct lightningd *ld,
|
||||
|
||||
case OPENINGD:
|
||||
/* Kill off openingd, forget old peer. */
|
||||
subd = peer->owner;
|
||||
peer->owner = NULL; /* We'll free it ourselves */
|
||||
tal_free(peer->owner);
|
||||
tal_free(subd);
|
||||
tal_free(peer);
|
||||
|
||||
/* A fresh start. */
|
||||
|
||||
Reference in New Issue
Block a user