<p>keith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">coverity: Address issue found by coverity<br><br>Add NULL checks on the return value of call_leg_other() in<br>update_rtp()<br><br>If the remote side has requested media change and we cannot<br>find the other leg, then release call. This should not<br>happen.<br><br>Also, Add an assert to show that we cannot be here<br>without call type of SIP or MNCC (not related to coverity)<br><br>Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42<br>---<br>M src/mncc.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.osmocom.org:29418/osmo-sip-connector refs/changes/43/15143/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/mncc.c b/src/mncc.c</span><br><span>index f5a44d5..7919c9b 100644</span><br><span>--- a/src/mncc.c</span><br><span>+++ b/src/mncc.c</span><br><span>@@ -211,10 +211,22 @@</span><br><span>        if (_leg->type == CALL_TYPE_MNCC) {</span><br><span>               leg = (struct mncc_call_leg *) _leg;</span><br><span>                 struct call_leg *other = call_leg_other(&leg->base);</span><br><span style="color: hsl(120, 100%, 40%);">+           if (!other) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 LOGP(DMNCC, LOGL_ERROR, "Failed to find other leg.");</span><br><span style="color: hsl(120, 100%, 40%);">+                       _leg->release_call(_leg);</span><br><span style="color: hsl(120, 100%, 40%);">+                  return;</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span>            send_rtp_connect(leg, other);</span><br><span style="color: hsl(0, 100%, 40%);">-   } else {</span><br><span style="color: hsl(120, 100%, 40%);">+      } else if (_leg->type == CALL_TYPE_SIP) {</span><br><span>                 leg = (struct mncc_call_leg *) call_leg_other(_leg);</span><br><span style="color: hsl(120, 100%, 40%);">+          if (!leg) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   LOGP(DMNCC, LOGL_ERROR, "Failed to find other leg.");</span><br><span style="color: hsl(120, 100%, 40%);">+                       _leg->release_call(_leg);</span><br><span style="color: hsl(120, 100%, 40%);">+                  return;</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span>            send_rtp_connect(leg, _leg);</span><br><span style="color: hsl(120, 100%, 40%);">+  } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              OSMO_ASSERT(false);</span><br><span>  }</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143">change 15143</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/c/osmo-sip-connector/+/15143"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sip-connector </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42 </div>
<div style="display:none"> Gerrit-Change-Number: 15143 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: keith <keith@rhizomatica.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>