common/rsl.c: fix possible NULL-pointer dereference

Change-Id: I11a35a8f500fafa7b3c93d2f2244cc4d42f09f1b
Fixes: CID#203810
This commit is contained in:
Vadim Yanitskiy 2019-09-07 00:01:27 +02:00 committed by fixeria
parent faf861b881
commit af2a8a6c81
1 changed files with 5 additions and 1 deletions

View File

@ -1745,10 +1745,14 @@ static int rsl_rx_sacch_inf_mod(struct msgb *msg)
/* 8.5.8 CBCH Load Information */
int rsl_tx_cbch_load_indication(struct gsm_bts *bts, bool ext_cbch, bool overflow, uint8_t amount)
{
struct gsm_lchan *lchan = gsm_bts_get_cbch(bts);
struct gsm_lchan *lchan;
struct msgb *msg;
uint8_t load_info;
lchan = gsm_bts_get_cbch(bts);
if (!lchan)
return -ENODEV;
msg = rsl_msgb_alloc(sizeof(struct abis_rsl_cchan_hdr));
if (!msg)
return -ENOMEM;