diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6cca61f859..a092b2790e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4281,7 +4281,7 @@ static int __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist) } /* Remove link from peer to subscription of MWI */ - if (p->relatedpeer && p->relatedpeer->mwipvt) + if (p->relatedpeer && p->relatedpeer->mwipvt == p) p->relatedpeer->mwipvt = dialog_unref(p->relatedpeer->mwipvt); if (dumphistory)