llc: Free allocated LLMEs when freeing main context

Change-Id: Ifb51a956d5a41f01184db4d453c64128db439f7c
This commit is contained in:
Pau Espin 2023-03-29 18:39:39 +02:00
parent 0bd994ee70
commit e8b8fb1b60
1 changed files with 11 additions and 1 deletions

View File

@ -121,6 +121,16 @@ static const struct gprs_llc_params llc_default_params[NUM_SAPIS] = {
},
};
static void gprs_llc_ctx_free(void)
{
struct gprs_llc_llme *llme;
while ((llme = llist_first_entry_or_null(&g_ctx->llme_list, struct gprs_llc_llme, list)))
gprs_llc_llme_free(llme);
talloc_free(g_ctx);
}
int osmo_gprs_llc_init(enum osmo_gprs_llc_location location, const char *cipher_plugin_path)
{
int rc;
@ -132,7 +142,7 @@ int osmo_gprs_llc_init(enum osmo_gprs_llc_location location, const char *cipher_
}
if (g_ctx)
talloc_free(g_ctx);
gprs_llc_ctx_free();
g_ctx = talloc_zero(NULL, struct gprs_llc_ctx);
g_ctx->location = location;