]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: Hold module reference for publications.
authorJoshua Colp <jcolp@digium.com>
Sun, 1 Jul 2018 18:54:05 +0000 (15:54 -0300)
committerJoshua Colp <jcolp@digium.com>
Mon, 2 Jul 2018 14:39:24 +0000 (11:39 -0300)
Incoming publications need to ensure that the module remains
loaded for the lifetime of them. This is now done by holding
a reference to the module while the publication exists. This
mirrors that of inbound subscriptions.

ASTERISK-27783

Change-Id: Ia98c95a15e11af25728d5fb3e56e12cda0cfc7c0

res/res_pjsip_pubsub.c

index 4526e02924004de886b004ca7bea57a353efe1e4..257922bccd1b224d1cec3fc774994844756a58b8 100644 (file)
@@ -3161,6 +3161,8 @@ static void publication_destroy_fn(void *obj)
 
        ao2_cleanup(publication->datastores);
        ao2_cleanup(publication->endpoint);
+
+       ast_module_unref(ast_module_info->self);
 }
 
 static struct ast_sip_publication *sip_create_publication(struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata,
@@ -3177,6 +3179,8 @@ static struct ast_sip_publication *sip_create_publication(struct ast_sip_endpoin
                return NULL;
        }
 
+       ast_module_ref(ast_module_info->self);
+
        if (!(publication->datastores = ao2_container_alloc(DATASTORE_BUCKETS, datastore_hash, datastore_cmp))) {
                ao2_ref(publication, -1);
                return NULL;