<p>Benjamin Keith Ford has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6528">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Check for removed stream state.<br><br>When a sip session is refreshed, the stream topology is looped<br>through, checking each stream for compatible formats. This would<br>cause a crash if the stream state was AST_STREAM_STATE_REMOVED,<br>since the formats would never be set for this stream, causing<br>a NULL value to be returned from ast_stream_get_formats. This<br>commit adds a check for streams with removed states.<br><br>Also removed a stray semicolon.<br><br>Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42<br>---<br>M main/bridge.c<br>M res/res_pjsip_session.c<br>2 files changed, 4 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/6528/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/bridge.c b/main/bridge.c<br>index b732d5f..051cec1 100644<br>--- a/main/bridge.c<br>+++ b/main/bridge.c<br>@@ -1741,7 +1741,7 @@<br> <br>       ao2_ref(bridge_channel, -1);<br> <br>-join_exit:;<br>+join_exit:<br>    ast_bridge_run_after_callback(chan);<br>  bridge_channel_impart_signal(chan);<br>   if (!(ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO)<br>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c<br>index b6fa8bb..854b35b 100644<br>--- a/res/res_pjsip_session.c<br>+++ b/res/res_pjsip_session.c<br>@@ -1465,14 +1465,14 @@<br>                                                ast_sip_session_media_state_free(media_state);<br>                                                return 0;<br>                                     }<br>-<br>-                                 ast_format_cap_get_compatible(ast_stream_get_formats(stream), session->endpoint->media.codecs, joint_cap);<br>+                                     if (ast_stream_get_state(stream) != AST_STREAM_STATE_REMOVED) {<br>+                                              ast_format_cap_get_compatible(ast_stream_get_formats(stream), session->endpoint->media.codecs, joint_cap);<br>+                                     }<br>                                     if (!ast_format_cap_count(joint_cap)) {<br>                                               ao2_ref(joint_cap, -1);<br>                                               ast_sip_session_media_state_free(media_state);<br>                                                return 0;<br>                                     }<br>-<br>                                  ast_stream_set_formats(stream, joint_cap);<br>                            }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6528">change 6528</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/6528"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15.0 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic86f8b65a4a26a60885b28b8b1a0b22e1b471d42 </div>
<div style="display:none"> Gerrit-Change-Number: 6528 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>