ASAN found 'heap-use-after-free' in gossip (link).
There is circular dependency in Stream and PeerContext.
Stream is passed as a weak pointer and is not locked here and PeerContext is passed as a const ref here.
So, after shared pointer to Stream is reset, the Stream and PeerContext are deleted and than the attempt to read here is made.
This PR keeps shared pointer to PeerContext.
ASAN found 'heap-use-after-free' in gossip (link).
There is circular dependency in
Stream
andPeerContext
.Stream
is passed as a weak pointer and is not locked here andPeerContext
is passed as a const ref here. So, after shared pointer toStream
is reset, theStream
andPeerContext
are deleted and than the attempt to read here is made. This PR keeps shared pointer toPeerContext
.