[asterisk-commits] rmudgett: branch 12 r412383 - in /branches/12: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 15 11:36:42 CDT 2014


Author: rmudgett
Date: Tue Apr 15 11:36:38 2014
New Revision: 412383

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412383
Log:
chan_sip.c: Moved some sip_pvt unrefs after their last use.

* Moved sip_pvt unref in ast_hangup() and handle_request_do() to the end
of the function.  The unref needs to happen after the last use of the
pointer.
........

Merged revisions 412348 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    branches/12/   (props changed)
    branches/12/channels/chan_sip.c

Propchange: branches/12/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: branches/12/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_sip.c?view=diff&rev=412383&r1=412382&r2=412383
==============================================================================
--- branches/12/channels/chan_sip.c (original)
+++ branches/12/channels/chan_sip.c Tue Apr 15 11:36:38 2014
@@ -7160,10 +7160,11 @@
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Really hang up next time */
 		if (p->owner) {
-			ast_channel_tech_pvt_set(p->owner, dialog_unref(ast_channel_tech_pvt(p->owner), "unref p->owner->tech_pvt"));
 			sip_pvt_lock(p);
+			oldowner = p->owner;
 			sip_set_owner(p, NULL); /* Owner will be gone after we return, so take it away */
 			sip_pvt_unlock(p);
+			ast_channel_tech_pvt_set(oldowner, dialog_unref(ast_channel_tech_pvt(oldowner), "unref oldowner->tech_pvt"));
 		}
 		ast_module_unref(ast_module_info->self);
 		return 0;
@@ -7199,7 +7200,7 @@
 	disable_dsp_detect(p);
 
 	sip_set_owner(p, NULL);
-	ast_channel_tech_pvt_set(ast, dialog_unref(ast_channel_tech_pvt(ast), "unref ast->tech_pvt"));
+	ast_channel_tech_pvt_set(ast, NULL);
 
 	ast_module_unref(ast_module_info->self);
 	/* Do not destroy this pvt until we have timeout or
@@ -7337,6 +7338,7 @@
 		pvt_set_needdestroy(p, "hangup");
 	}
 	sip_pvt_unlock(p);
+	dialog_unref(p, "unref ast->tech_pvt");
 	return 0;
 }
 
@@ -28474,12 +28476,12 @@
 		ast_channel_unref(owner_chan_ref);
 	}
 	sip_pvt_unlock(p);
-	ao2_t_ref(p, -1, "throw away dialog ptr from find_call at end of routine"); /* p is gone after the return */
 	ast_mutex_unlock(&netlock);
 
 	if (p->logger_callid) {
 		ast_callid_threadassoc_remove();
 	}
+	ao2_t_ref(p, -1, "throw away dialog ptr from find_call at end of routine"); /* p is gone after the return */
 
 	return 1;
 }




More information about the asterisk-commits mailing list