aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_network.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-17 09:22:57 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-17 14:36:51 +0100
commit1dc022cb620e4e30953cfe72fe743431853df466 (patch)
treef022e6d13dd489ccb8cb04198a68053c7816dc9c /openbsc/src/libmgcp/mgcp_network.c
parentcaae10b71fb0ee752e199ccdc57dbede99db7c89 (diff)
openbsc: Fix coverity issues
This patch (hopefully) fixes the new defects reported by coverity. Addresses: ** CID 1156986: Negative array index read (NEGATIVE_RETURNS) /tests/gsm0408/gsm0408_test.c: 419 in test_si_range_helpers() /tests/gsm0408/gsm0408_test.c: 423 in test_si_range_helpers() /tests/gsm0408/gsm0408_test.c: 427 in test_si_range_helpers() ** CID 1156987: Unchecked return value from library (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 1150 in mgcp_keepalive_timer_cb() ** CID 1156988: Unchecked return value from library (CHECKED_RETURN) /src/libmgcp/mgcp_protocol.c: 983 in handle_modify_con() Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_network.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 0cc20416..b55ac045 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -134,11 +134,24 @@ int mgcp_send_dummy(struct mgcp_endpoint *endp)
rc = mgcp_udp_send(endp->net_end.rtp.fd, &endp->net_end.addr,
endp->net_end.rtp_port, buf, 1);
- if (rc == -1 || endp->tcfg->omit_rtcp)
+ if (rc == -1)
+ goto failed;
+
+ if (endp->tcfg->omit_rtcp)
+ return rc;
+
+ rc = mgcp_udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
+ endp->net_end.rtcp_port, buf, 1);
+
+ if (rc >= 0)
return rc;
- return mgcp_udp_send(endp->net_end.rtcp.fd, &endp->net_end.addr,
- endp->net_end.rtcp_port, buf, 1);
+failed:
+ LOGP(DMGCP, LOGL_ERROR,
+ "Failed to send dummy packet: %s on: 0x%x to %s\n",
+ strerror(errno), ENDPOINT_NUMBER(endp), inet_ntoa(endp->net_end.addr));
+
+ return -1;
}
static int32_t compute_timestamp_aligment_error(struct mgcp_rtp_stream_state *sstate,