pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/38082?usp=email )
Change subject: bts: Make sure bts_location entries in bts->loc_list are freed ......................................................................
bts: Make sure bts_location entries in bts->loc_list are freed
This went unnoticed because so far there's not clear way to free a BTS, eg. through VTY.
Change-Id: I4de3d56a4f1f6bd1fe880b72cdd384c2398dabc9 --- M include/osmocom/bsc/bts.h M src/osmo-bsc/bts.c M src/osmo-bsc/bts_ctrl.c 3 files changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/82/38082/1
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index a8680d8..38e675a 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -337,7 +337,7 @@ /* list header in net->bts_list */ struct llist_head list;
- /* Geographical location of the BTS */ + /* Geographical location of the BTS, head list of "struct bts_location" */ struct llist_head loc_list;
/* number of this BTS in network */ diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index 260e24e..e3d909f 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -156,6 +156,9 @@
static int gsm_bts_talloc_destructor(struct gsm_bts *bts) { + + /* Entries in bts->loc_list are freed by talloc recursively, no need to free them here. */ + paging_destructor(bts); bts_setup_ramp_remove(bts);
diff --git a/src/osmo-bsc/bts_ctrl.c b/src/osmo-bsc/bts_ctrl.c index 48b1b8a..76806f4 100644 --- a/src/osmo-bsc/bts_ctrl.c +++ b/src/osmo-bsc/bts_ctrl.c @@ -169,7 +169,7 @@ return CTRL_CMD_ERROR; }
- curloc = talloc_zero(tall_bsc_ctx, struct bts_location); + curloc = talloc_zero(bts, struct bts_location); if (!curloc) { talloc_free(tmp); goto oom;