pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/28075 )
Change subject: gprs_pcu: Explicitly free all bts objects in list before freeing pcu ......................................................................
gprs_pcu: Explicitly free all bts objects in list before freeing pcu
This is mostly important to unit tests, where the gprs_pcu object is recreated several times (it is not recreated in normal operation).
The BTS objects are already being freed through talloc dependency tree. However, since they may trigger counter updates, access to the pcu list, etc, let's better do it explicitly before erasing gprs_pcu object fields.
Related: OS#5555 Change-Id: If2a8360e214d993a8a89993532ff1099b30bdbb1 --- M src/gprs_pcu.c 1 file changed, 4 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c index e8dba06..ecb7f29 100644 --- a/src/gprs_pcu.c +++ b/src/gprs_pcu.c @@ -61,6 +61,10 @@
static int gprs_pcu_talloc_destructor(struct gprs_pcu *pcu) { + struct gprs_rlcmac_bts *bts; + while ((bts = llist_first_entry_or_null(&pcu->bts_list, struct gprs_rlcmac_bts, list))) + talloc_free(bts); + if (osmo_timer_pending(&pcu->update_stats_timer)) osmo_timer_del(&pcu->update_stats_timer); neigh_cache_free(pcu->neigh_cache);