<p>Ross Beer has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8455">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip_transport_events.c Crash on chan_pjsip transport disconnect<br><br>ASTERISK-27688<br><br>Change-Id: Ia9b5469fea8f2b3f2d8476fae6b748a4d23e7261<br>---<br>M res/res_pjsip/pjsip_transport_events.c<br>1 file changed, 13 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/55/8455/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/pjsip_transport_events.c b/res/res_pjsip/pjsip_transport_events.c<br>index c701b84..ecf0925 100644<br>--- a/res/res_pjsip/pjsip_transport_events.c<br>+++ b/res/res_pjsip/pjsip_transport_events.c<br>@@ -216,7 +216,12 @@<br> if (notifier->cb == cb_data->cb && (!cb_data->data<br> || cb_data->matches(cb_data->data, notifier->data))) {<br> ao2_cleanup(notifier->data);<br>+ <br> AST_VECTOR_REMOVE_UNORDERED(&monitored->monitors, idx);<br>+ <br>+ /* Decrement pjsip transport ref */<br>+ pjsip_transport_dec_ref(monitored->transport);<br>+ <br> ast_debug(3, "Unregistered monitor %p(%p) from transport %s\n",<br> notifier->cb, notifier->data, monitored->transport->obj_name);<br> }<br>@@ -271,7 +276,7 @@<br> .matches = matches ?: ptr_matcher,<br> };<br> <br>- transport_monitor_unregister_cb(monitored, &cb_data, 0);<br>+ transport_monitor_unregister_cb(monitored, &cb_data, 0); <br> ao2_ref(monitored, -1);<br> }<br> ao2_unlock(transports);<br>@@ -300,6 +305,9 @@<br> /* Add new monitor to vector */<br> new_monitor.cb = cb;<br> new_monitor.data = ao2_bump(ao2_data);<br>+ <br>+ <br>+ <br> if (AST_VECTOR_APPEND(&monitored->monitors, new_monitor)) {<br> ao2_cleanup(ao2_data);<br> res = AST_TRANSPORT_MONITOR_REG_FAILED;<br>@@ -307,6 +315,10 @@<br> cb, ao2_data, transport->obj_name);<br> } else {<br> res = AST_TRANSPORT_MONITOR_REG_SUCCESS;<br>+ <br>+ /* Add pjsip transport ref */<br>+ pjsip_transport_add_ref(monitored->transport);<br>+ <br> ast_debug(3, "Registered monitor %p(%p) to transport %s\n",<br> cb, ao2_data, transport->obj_name);<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8455">change 8455</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8455"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia9b5469fea8f2b3f2d8476fae6b748a4d23e7261 </div>
<div style="display:none"> Gerrit-Change-Number: 8455 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Ross Beer <ross.beer@voicehost.co.uk> </div>