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

Anonymous Coward asteriskteam at digium.com
Wed Jul 13 22:11:42 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

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

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c14f8ba..0336e2a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17186,10 +17186,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/3190
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If7ecd52facdc5c227f701c760841e3f6ca53cc69
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list