coverity: fix null deref from recent UL TBF leak fix
Fix a possible NULL deref, introduced in recent patch
I8ce21be6836549b47a606c00b793d6f005964c5c /
d8e8ea9c8f16e0a1d09c2ea4395e15eac7358ed2
Related: OS#5205 SYS#5561 CID#239246
Change-Id: I603d4a5bc0fe5bd2e9f0dba171604c459e38aeaf
diff --git a/src/bts.cpp b/src/bts.cpp
index b5fdfee..a40e071 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1162,13 +1162,16 @@
{
struct gprs_rlcmac_pdch *pdch = &bts->trx[trx_no].pdch[ts];
struct pdch_ulc_node *poll = pdch_ulc_get_node(pdch->ulc, fn);
- struct gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(poll->tbf_poll.poll_tbf);
+ struct gprs_rlcmac_ul_tbf *ul_tbf;
if (!poll || poll->type !=PDCH_ULC_NODE_TBF_POLL ||
- poll->tbf_poll.poll_tbf->direction != GPRS_RLCMAC_UL_TBF)
+ poll->tbf_poll.poll_tbf->direction != GPRS_RLCMAC_UL_TBF) {
LOGP(DL1IF, LOGL_DEBUG, "[%s] update TA = %u ignored due to "
"unknown UL TBF on TRX = %d, TS = %d, FN = %d\n",
p, ta, trx_no, ts, fn);
- else if (ul_tbf) {
+ return;
+ }
+ ul_tbf = as_ul_tbf(poll->tbf_poll.poll_tbf);
+ if (ul_tbf) {
/* we need to distinguish TA information provided by L1
* from PH-DATA-IND and PHY-RA-IND so that we can properly
* update TA for given TBF