[Asterisk-code-review] res_pjsip_mwi: Remove inappropriate topic unreference. (...asterisk[13])

Corey Farrell asteriskteam at digium.com
Thu Sep 19 15:22:04 CDT 2019


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/12903


Change subject: res_pjsip_mwi: Remove inappropriate topic unreference.
......................................................................

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
---
M main/stasis_cache.c
M res/res_pjsip_mwi.c
2 files changed, 1 insertion(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/12903/1

diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 541261a..0f2d443 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -870,7 +870,7 @@
 			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 46f890b..810db5d 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -266,7 +266,6 @@
 		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. */

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12903
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7
Gerrit-Change-Number: 12903
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190919/d289d9f4/attachment.html>


More information about the asterisk-code-review mailing list