[sr-dev] git:master:ef44e5b8: tm: more debug info when freeing a transaction

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 23 12:44:23 CEST 2015


Module: kamailio
Branch: master
Commit: ef44e5b8b4292f4c4ff3a77e46bbb33e5e0f077f
URL: https://github.com/kamailio/kamailio/commit/ef44e5b8b4292f4c4ff3a77e46bbb33e5e0f077f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-23T12:43:41+02:00

tm: more debug info when freeing a transaction

- attempt to catch a double free

---

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

---

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

---

diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index e3bc1b4..c38885a 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -115,7 +115,7 @@ unsigned int transaction_count( void )
 
 
 
-void free_cell( struct cell* dead_cell )
+void free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline )
 {
 	char *b;
 	int i;
@@ -123,6 +123,8 @@ void free_cell( struct cell* dead_cell )
 	struct totag_elem *tt, *foo;
 	struct tm_callback *cbs, *cbs_tmp;
 
+	LM_WARN("===== freeing transaction %p from %s:%u\n", dead_cell, fname, fline);
+
 	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/h_table.h b/modules/tm/h_table.h
index db35212..9340e5b 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -552,7 +552,10 @@ struct s_table* tm_get_table(void);
 
 struct s_table* init_hash_table(void);
 void   free_hash_table(void);
-void   free_cell( struct cell* dead_cell );
+
+void   free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline);
+#define free_cell(t) free_cell_helper((t), __FILE__, __LINE__)
+
 struct cell*  build_cell( struct sip_msg* p_msg );
 
 #ifdef TM_HASH_STATS




More information about the sr-dev mailing list