There is a typo introduced in D10711. We need to access the proof associated with a peer after it gets deleted, so we copy the shared pointer. Unfortunately there is a place where the original pointer was used instead, causing a potential use after free issue.
Ref T1854.