Module: kamailio
Branch: 4.3
Commit: 0066abcf28d707be7444ccb709cbeb9f37c636be
URL: 
https://github.com/kamailio/kamailio/commit/0066abcf28d707be7444ccb709cbeb9f37c636be

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-11-16T11:59:23+01:00

tm: unlink cell and its timer in free function if structure still linked in 
clist

(cherry picked from commit 2fad76064992af047244e30c6152bf0f05a0785f)

---

Modified: modules/tm/h_table.c
Modified: modules/tm/t_lookup.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0066abcf28d707be7444ccb709cbeb9f37c636be.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0066abcf28d707be7444ccb709cbeb9f37c636be.patch

---

diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index b603e99..8965cff 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -125,6 +125,11 @@ void free_cell_helper( struct cell* dead_cell, const char 
*fname, unsigned int f
 
        LM_DBG("freeing transaction %p from %s:%u\n", dead_cell, fname, fline);
 
+       if(dead_cell->prev_c!=NULL && dead_cell->next_c!=NULL) {
+               LM_WARN("removed cell %p is still linked in hash table\n", 
dead_cell);
+               unlink_timers(dead_cell);
+               remove_from_hash_table_unsafe(dead_cell);
+       }
        release_cell_lock( dead_cell );
        if (unlikely(has_tran_tmcbs(dead_cell, TMCB_DESTROY)))
                run_trans_callbacks(TMCB_DESTROY, dead_cell, 0, 0, 0);
diff --git a/modules/tm/t_lookup.c b/modules/tm/t_lookup.c
index fb197c8..7bff2a4 100644
--- a/modules/tm/t_lookup.c
+++ b/modules/tm/t_lookup.c
@@ -1568,7 +1568,7 @@ int t_lookup_ident(struct cell ** trans, unsigned int 
hash_index,
                prefetch_loc_r(p_cell->next_c, 1);
                if(p_cell->label == label){
                        REF_UNSAFE(p_cell);
-                       UNLOCK_HASH(hash_index);
+                       UNLOCK_HASH(hash_index);
                        set_t(p_cell, T_BR_UNDEFINED);
                        *trans=p_cell;
                        DBG("DEBUG: t_lookup_ident: transaction found\n");


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to