From f30ebd3823295c893398f2c66b3755aae07da0e6 Mon Sep 17 00:00:00 2001 From: Joshua Colp <jcolp@digium.com> Date: Sun, 1 Jul 2018 15:54:05 -0300 Subject: [PATCH] res_pjsip_pubsub: Hold module reference for publications. 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index d98491495a..587c533eff 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -3091,6 +3091,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, @@ -3107,6 +3109,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 = ast_datastores_alloc())) { ao2_ref(publication, -1); return NULL; -- GitLab