aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-12-28 21:35:02 +0600
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-12-28 22:01:35 +0600
commit41d9e2c093e3df6f1d03c6723e190da7dbe7c503 (patch)
tree947490c6cce7eab1dc288386833b2c95c74b2162 /src
parentd4ebb1f6c47e89d8aae7988593969ca2a435b392 (diff)
phy_instance_destroy(): fix NULL pointer dereference
It's possible that a PHY instance has no associated TRX instance. Change-Id: Id028577ef92d1b3ce63ba62b63b8b29edb2ae5a4 Fixes: OS#5377
Diffstat (limited to 'src')
-rw-r--r--src/common/phy_link.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/phy_link.c b/src/common/phy_link.c
index 5ad72ac7..352d8f72 100644
--- a/src/common/phy_link.c
+++ b/src/common/phy_link.c
@@ -129,10 +129,12 @@ void phy_instance_destroy(struct phy_instance *pinst)
/* remove from list of instances in the link */
llist_del(&pinst->list);
- /* remove reverse link from TRX */
- OSMO_ASSERT(pinst->trx->pinst == pinst);
- pinst->trx->pinst = NULL;
- pinst->trx = NULL;
+ /* remove reverse link from TRX (if associated) */
+ if (pinst->trx != NULL) {
+ OSMO_ASSERT(pinst->trx->pinst == pinst);
+ pinst->trx->pinst = NULL;
+ pinst->trx = NULL;
+ }
talloc_free(pinst);
}