Stasis: Fix unsafe use of stasis_unsubscribe in modules.
[asterisk/asterisk.git] / channels / chan_sip.c
index 9eeb75f..7c4c8a6 100644 (file)
@@ -5008,7 +5008,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
 static void destroy_mailbox(struct sip_mailbox *mailbox)
 {
        if (mailbox->event_sub) {
 static void destroy_mailbox(struct sip_mailbox *mailbox)
 {
        if (mailbox->event_sub) {
-               mailbox->event_sub = stasis_unsubscribe(mailbox->event_sub);
+               mailbox->event_sub = stasis_unsubscribe_and_join(mailbox->event_sub);
        }
        ast_free(mailbox);
 }
        }
        ast_free(mailbox);
 }