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

Kevin Harwell asteriskteam at digium.com
Mon Sep 23 15:19:09 CDT 2019


Kevin Harwell has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12904 )

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(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved; Approved for Submit



diff --git a/main/stasis_cache.c b/main/stasis_cache.c
index 6be4bf1..bcd7e7d 100644
--- a/main/stasis_cache.c
+++ b/main/stasis_cache.c
@@ -868,7 +868,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 2414546..82f6e46 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/+/12904
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7
Gerrit-Change-Number: 12904
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190923/20a316ab/attachment.html>


More information about the asterisk-code-review mailing list