aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2019-08-09 01:14:43 +0200
committerKeith <keith@rhizomatica.org>2019-08-09 14:12:32 +0200
commit5319d4d979485e5508f545fe68dd54e40a2be7d0 (patch)
tree94e0173938b51796867ca5e7c8f69049349bcaac
parentf56af15181afdeeb9b517c589b7a220820b0083b (diff)
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
-rw-r--r--src/mncc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mncc.c b/src/mncc.c
index f5a44d5..e23bd6f 100644
--- a/src/mncc.c
+++ b/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);
}