Change in ...osmo-sip-connector[master]: coverity: Address issue found by coverity

keith gerrit-no-reply at lists.osmocom.org
Sat Aug 10 14:49:41 UTC 2019


keith has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143 )

Change subject: coverity: Address issue found by coverity
......................................................................

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
---
M src/mncc.c
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, but someone else must approve
  keith: Looks good to me, approved



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 @@
 	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);
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42
Gerrit-Change-Number: 15143
Gerrit-PatchSet: 5
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: keith <keith at rhizomatica.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190810/e8271960/attachment.html>


More information about the gerrit-log mailing list