summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_publish.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip_outbound_publish.c')
-rw-r--r--res/res_pjsip_outbound_publish.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index dd093a518..66522d036 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -695,8 +695,15 @@ static int explicit_publish_destroy(void *data)
{
struct ast_sip_outbound_publish_client *client = data;
- pjsip_publishc_destroy(client->client);
- ao2_ref(client, -1);
+ /*
+ * If there is no pjsip publishing client then we obviously don't need
+ * to destroy it. Also, the ref for the Asterisk publishing client that
+ * pjsip had would not exist or should already be gone as well.
+ */
+ if (client->client) {
+ pjsip_publishc_destroy(client->client);
+ ao2_ref(client, -1);
+ }
return 0;
}
@@ -1281,7 +1288,7 @@ static int unload_module(void)
/* wait for items to unpublish */
ast_verb(5, "Waiting to complete unpublishing task(s)\n");
- while (unloading.count) {
+ while (unloading.count && !res) {
res = ast_cond_timedwait(&unloading.cond, &unloading.lock, &end);
}
ast_mutex_unlock(&unloading.lock);