pespin has uploaded this change for review.
rlcmac: Make sure entities are freed if lib is re-initialized
This allows proper memory cleanup of the whole library everytime we want
to run a new unit test in the same proces.
Change-Id: I568e2f783a575ae457f0845eca34951ae9822eeb
---
M src/rlcmac/rlcmac.c
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/84/31284/1
diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c
index 424008a..1fae450 100644
--- a/src/rlcmac/rlcmac.c
+++ b/src/rlcmac/rlcmac.c
@@ -41,6 +41,16 @@
{ 0 } /* empty item at the end */
};
+static void gprs_rlcmac_ctx_free(void)
+{
+ struct gprs_rlcmac_entity *gre;
+
+ while ((gre = llist_first_entry_or_null(&g_ctx->gre_list, struct gprs_rlcmac_entity, entry)))
+ gprs_rlcmac_entity_free(gre);
+
+ talloc_free(g_ctx);
+}
+
int osmo_gprs_rlcmac_init(enum osmo_gprs_rlcmac_location location)
{
bool first_init = true;
@@ -48,7 +58,7 @@
OSMO_ASSERT(location == OSMO_GPRS_RLCMAC_LOCATION_MS || location == OSMO_GPRS_RLCMAC_LOCATION_PCU)
if (g_ctx) {
- talloc_free(g_ctx);
+ gprs_rlcmac_ctx_free();
first_init = false;
}
To view, visit change 31284. To unsubscribe, or for help writing mail filters, visit settings.