stats: Only dereference a connection pointer after checking for NULL.

Addresses CID 210261.

Change-Id: Ic7e7c92c5b9ff696fa7f4cd0d69451cd22333f71
This commit is contained in:
Alexander Chemeris 2020-05-10 22:43:03 +03:00
parent 0ae129e9f0
commit 169c229d27
1 changed files with 2 additions and 1 deletions

View File

@ -1104,7 +1104,7 @@ static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,
struct msgb *gsm48;
uint8_t *data;
int rc, dtap_rc;
struct rate_ctr *ctrs = conn->sccp.msc->msc_ctrs->ctr;
struct rate_ctr *ctrs;
LOGP(DMSC, LOGL_DEBUG, "Rx MSC DTAP: %s\n",
osmo_hexdump(msg->l3h, length));
@ -1114,6 +1114,7 @@ static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,
return -1;
}
ctrs = conn->sccp.msc->msc_ctrs->ctr;
header = (struct dtap_header *) msg->l3h;
if (sizeof(*header) >= length) {
rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DTAP_ERROR]);