[Asterisk-code-review] chan sip: Fix reference leak in mwi event cb (asterisk[master])

Corey Farrell asteriskteam at digium.com
Wed Jul 13 14:10:41 CDT 2016


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/3191

Change subject: chan_sip: Fix reference leak in mwi_event_cb
......................................................................

chan_sip: Fix reference leak in mwi_event_cb

Cleanup the peer reference when stasis_subscription_final_message is
true.  Also free peer_name even if peer exists, after reload a new
peer_name will be allocated.

ASTERISK-26193 #close

Change-Id: If7ecd52facdc5c227f701c760841e3f6ca53cc69
---
M channels/chan_sip.c
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/3191/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 599ecd6..b2522b6 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17229,10 +17229,8 @@
 	struct sip_peer *peer = sip_find_peer(peer_name, NULL, TRUE, FINDALLDEVICES, FALSE, 0);
 
 	if (stasis_subscription_final_message(sub, msg)) {
-		if (peer) {
-			/* configuration reloaded */
-			return;
-		}
+		/* peer can be non-NULL during reload. */
+		ao2_cleanup(peer);
 		ast_free(peer_name);
 		return;
 	}

-- 
To view, visit https://gerrit.asterisk.org/3191
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7ecd52facdc5c227f701c760841e3f6ca53cc69
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list