mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-08 00:24:28 +01:00
Fix double free of message buffer.
Message buffer `why` is allocated in the `peer` context and also freed when peer is freed. Only explicitly free the buffer when peer itself is not freed yet.
This commit is contained in:
committed by
Rusty Russell
parent
3c0d2813a0
commit
44836ef509
@@ -208,11 +208,11 @@ void peer_fail_permanent(struct peer *peer, const char *fmt, ...)
|
||||
}
|
||||
|
||||
peer_set_owner(peer, NULL);
|
||||
if (peer_persists(peer))
|
||||
if (peer_persists(peer)) {
|
||||
drop_to_chain(peer);
|
||||
else
|
||||
tal_free(why);
|
||||
} else
|
||||
free_peer(peer, why);
|
||||
tal_free(why);
|
||||
}
|
||||
|
||||
void peer_internal_error(struct peer *peer, const char *fmt, ...)
|
||||
|
||||
Reference in New Issue
Block a user