[sr-dev] git:4.3:171df16d: tm: more debug info when freeing a transaction

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 16 12:03:27 CET 2015


Module: kamailio
Branch: 4.3
Commit: 171df16dea1d2c6215b6aa50a49157cf253f502f
URL: https://github.com/kamailio/kamailio/commit/171df16dea1d2c6215b6aa50a49157cf253f502f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-16T11:53:00+01:00

tm: more debug info when freeing a transaction

- attempt to catch a double free

(cherry picked from commit ef44e5b8b4292f4c4ff3a77e46bbb33e5e0f077f)

---

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

---

Diff:  https://github.com/kamailio/kamailio/commit/171df16dea1d2c6215b6aa50a49157cf253f502f.diff
Patch: https://github.com/kamailio/kamailio/commit/171df16dea1d2c6215b6aa50a49157cf253f502f.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