coverity: Address issue found by coverity

Add NULL checks on the return value of call_leg_other() in
update_rtp()

If the remote side has requested media change and we cannot
find the other leg, then release call. This should not
happen.

Also, Add an assert to show that we cannot be here
without call type of SIP or MNCC (not related to coverity)

Fixes: CID#202863
Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42
changes/43/15143/5
Keith Whyte 3 years ago
parent f56af15181
commit 5319d4d979
  1. 12
      src/mncc.c

@ -211,11 +211,21 @@ static void update_rtp(struct call_leg *_leg) {
if (_leg->type == CALL_TYPE_MNCC) {
leg = (struct mncc_call_leg *) _leg;
struct call_leg *other = call_leg_other(&leg->base);
if (!other)
goto ret_release;
send_rtp_connect(leg, other);
} else {
} else if (_leg->type == CALL_TYPE_SIP) {
leg = (struct mncc_call_leg *) call_leg_other(_leg);
if (!leg)
goto ret_release;
send_rtp_connect(leg, _leg);
} else {
OSMO_ASSERT(false);
}
return;
ret_release:
LOGP(DMNCC, LOGL_ERROR, "Failed to find other leg.\n");
_leg->release_call(_leg);
}

Loading…
Cancel
Save