aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-25 12:51:18 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-25 12:52:44 +0100
commit989f779cfcaa89a6e1d979a3ba7d5ab8b16613b6 (patch)
tree7f5283fe822ac69a0d0a3a5cb2a5251dc64f54db
parent9c4ea743fdf0501be64bc09f8c6ae982da21627c (diff)
RSL IPA DLCX: Avoid another null-pointer dereference
In case a DLCX _with conn-id_ is issued without any CRCX before, we ran into a NULL pointer dereference in adding the connection statistics. Let's handle this gracefully and simply return empty statistics. Change-Id: If8b71266c847b90cdc51695b9f47b527c51bd70c Closes: OS#2996
-rw-r--r--src/common/rsl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 2f6e295a..5c266ba7 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1482,14 +1482,13 @@ static void rsl_add_rtp_stats(struct gsm_lchan *lchan, struct msgb *msg)
struct ipa_stats stats;
-
memset(&stats, 0, sizeof(stats));
-
- osmo_rtp_socket_stats(lchan->abis_ip.rtp_socket,
- &stats.packets_sent, &stats.octets_sent,
- &stats.packets_recv, &stats.octets_recv,
- &stats.packets_lost, &stats.arrival_jitter);
+ if (lchan->abis_ip.rtp_socket)
+ osmo_rtp_socket_stats(lchan->abis_ip.rtp_socket,
+ &stats.packets_sent, &stats.octets_sent,
+ &stats.packets_recv, &stats.octets_recv,
+ &stats.packets_lost, &stats.arrival_jitter);
/* convert to network byte order */
stats.packets_sent = htonl(stats.packets_sent);
stats.octets_sent = htonl(stats.octets_sent);