From d08a7f4ad5f73dfef2121f13d5f2030f0b58c073 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Mon, 22 Dec 2014 14:49:28 +0000
Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6308
 818b1a75-f10b-46b9-bf7c-635c3b92a50f

---
 openair2/LAYER2/RLC/rlc_rrc.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index 63ba8c4362a..1eaf0d36d6f 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -514,6 +514,7 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
     logical_chan_id_t      lcid            = 0;
     hash_key_t             key             = HASHTABLE_QUESTIONABLE_KEY_VALUE;
     hashtable_rc_t         h_rc;
+    rlc_union_t           *rlc_union_p = NULL;
 #ifdef Rel10
     rlc_mbms_id_t         *mbms_id_p  = NULL;
 #endif
@@ -570,8 +571,21 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
 
     AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
 
-    h_rc = hashtable_remove(rlc_coll_p, key);
+    h_rc = hashtable_get(rlc_coll_p, key, &rlc_union_p);
     if (h_rc == HASH_TABLE_OK) {
+        switch (rlc_union_p->mode) {
+            case RLC_MODE_AM:
+                rlc_am_cleanup(&rlc_union_p->rlc.am);
+                break;
+            case RLC_MODE_UM:
+                rlc_um_cleanup(&rlc_union_p->rlc.um);
+                break;
+            case RLC_MODE_TM:
+                rlc_tm_cleanup(&rlc_union_p->rlc.tm);
+                break;
+            default:
+        }
+        h_rc = hashtable_remove(rlc_coll_p, key);
         LOG_D(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASED %s\n",
             frameP,
             (enb_flagP) ? "eNB" : "UE",
-- 
GitLab