From: Corey Farrell Date: Thu, 19 Sep 2019 16:06:07 +0000 (-0400) Subject: res_pjsip_mwi: Remove inappropriate topic unreference. X-Git-Tag: 13.30.0-rc1~65^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48fd773743e5df4a4e1c22ef8654c4537ab76d77;p=thirdparty%2Fasterisk.git res_pjsip_mwi: Remove inappropriate topic unreference. ast_mwi_topic() returns a borrowed reference which should not be unreferenced, doing so leads to a FRACK. This was hidden by the fact that stasis_cache.c leaked the result of cache_remove in caching_topic_exec. Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7 --- diff --git a/main/stasis_cache.c b/main/stasis_cache.c index 541261a87c..0f2d443042 100644 --- a/main/stasis_cache.c +++ b/main/stasis_cache.c @@ -870,7 +870,7 @@ static void caching_topic_exec(void *data, struct stasis_subscription *sub, ao2_wrlock(caching_topic->cache->entries); sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid); if (sub) { - cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message)); + ao2_cleanup(cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message))); ao2_cleanup(sub); } ao2_unlock(caching_topic->cache->entries); diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c index 46f890beb3..810db5d9cb 100644 --- a/res/res_pjsip_mwi.c +++ b/res/res_pjsip_mwi.c @@ -266,7 +266,6 @@ static struct mwi_stasis_subscription *mwi_stasis_subscription_alloc(const char mailbox, mwi_sub->id, stasis_topic_name(topic), topic, (int)ao2_ref(topic, 0)); ao2_ref(mwi_sub, +1); mwi_stasis_sub->stasis_sub = stasis_subscribe_pool(topic, mwi_stasis_cb, mwi_sub); - ao2_ref(topic, -1); if (!mwi_stasis_sub->stasis_sub) { /* Failed to subscribe. */