pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/31284 )

Change subject: rlcmac: Make sure entities are freed if lib is re-initialized
......................................................................

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(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c
index 97516d5..f8e3939 100644
--- a/src/rlcmac/rlcmac.c
+++ b/src/rlcmac/rlcmac.c
@@ -40,6 +40,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;
@@ -47,7 +57,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;
        }




1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31284
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I568e2f783a575ae457f0845eca34951ae9822eeb
Gerrit-Change-Number: 31284
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to