[Asterisk-code-review] res pjsip send to voicemail.c: Fix off-nominal double channe... (asterisk[master])

Anonymous Coward asteriskteam at digium.com
Wed Mar 2 21:24:14 CST 2016


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

Change subject: res_pjsip_send_to_voicemail.c: Fix off-nominal double channel unref.
......................................................................


res_pjsip_send_to_voicemail.c: Fix off-nominal double channel unref.

* Fix double unref of other_party channel in off nominal path.

* This is unlikely to be a real problem.  However, for safety,
in handle_incoming_request() keep the datastore ref with the
other_party channel ref until we are finished with the other_party
channel.

Change-Id: I78f22547bf0bb99fb20814ceab75952bd857f821
---
M res/res_pjsip_send_to_voicemail.c
1 file changed, 1 insertion(+), 2 deletions(-)

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



diff --git a/res/res_pjsip_send_to_voicemail.c b/res/res_pjsip_send_to_voicemail.c
index 9d2b5b1..cd0f05f 100644
--- a/res/res_pjsip_send_to_voicemail.c
+++ b/res/res_pjsip_send_to_voicemail.c
@@ -160,12 +160,10 @@
 	sip_session_datastore->data = other_party;
 
 	if (ast_sip_session_add_datastore(session, sip_session_datastore)) {
-		ast_channel_unref(other_party);
 		ao2_ref(sip_session_datastore, -1);
 		send_response(session, 500, rdata);
 		return -1;
 	}
-	ao2_ref(sip_session_datastore, -1);
 
 	if (has_feature) {
 		pbx_builtin_setvar_helper(other_party, SEND_TO_VM_HEADER,
@@ -177,6 +175,7 @@
 					  SEND_TO_VM_REDIRECT_VALUE);
 	}
 
+	ao2_ref(sip_session_datastore, -1);
 	return 0;
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I78f22547bf0bb99fb20814ceab75952bd857f821
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list