Stasis: Fix unsafe use of stasis_unsubscribe in modules.
[asterisk/asterisk.git] / res / res_xmpp.c
index 5a3670e..2a087b0 100644 (file)
@@ -3568,12 +3568,12 @@ int ast_xmpp_client_disconnect(struct ast_xmpp_client *client)
        }
 
        if (client->mwi_sub) {
        }
 
        if (client->mwi_sub) {
-               client->mwi_sub = stasis_unsubscribe(client->mwi_sub);
+               client->mwi_sub = stasis_unsubscribe_and_join(client->mwi_sub);
                xmpp_pubsub_unsubscribe(client, "message_waiting");
        }
 
        if (client->device_state_sub) {
                xmpp_pubsub_unsubscribe(client, "message_waiting");
        }
 
        if (client->device_state_sub) {
-               client->device_state_sub = stasis_unsubscribe(client->device_state_sub);
+               client->device_state_sub = stasis_unsubscribe_and_join(client->device_state_sub);
                xmpp_pubsub_unsubscribe(client, "device_state");
        }
 
                xmpp_pubsub_unsubscribe(client, "device_state");
        }