pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32125 )
Change subject: gmm: Free allocated GMMEs when freeing main context ......................................................................
gmm: Free allocated GMMEs when freeing main context
Change-Id: I092b2d133467d1c2dcb8dfe5def99d49807b6273 --- M src/gmm/gmm.c 1 file changed, 20 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c index 163bbe8..a8b8362 100644 --- a/src/gmm/gmm.c +++ b/src/gmm/gmm.c @@ -78,6 +78,16 @@ { 0 } /* empty item at the end */ };
+static void gprs_gmm_ctx_free(void) +{ + struct gprs_gmm_entity *gmme; + + while ((gmme = llist_first_entry_or_null(&g_ctx->gmme_list, struct gprs_gmm_entity, list))) + gprs_gmm_gmme_free(gmme); + + talloc_free(g_ctx); +} + int osmo_gprs_gmm_init(enum osmo_gprs_gmm_location location) { bool first_init = true; @@ -86,7 +96,7 @@
if (g_ctx) { first_init = false; - talloc_free(g_ctx); + gprs_gmm_ctx_free(); }
g_ctx = talloc_zero(NULL, struct gprs_gmm_ctx);