Преглед изворни кода

tm: more debug info when freeing a transaction

- attempt to catch a double free
Daniel-Constantin Mierla пре 10 година
родитељ
комит
ef44e5b8b4
2 измењених фајлова са 7 додато и 2 уклоњено
  1. 3 1
      modules/tm/h_table.c
  2. 4 1
      modules/tm/h_table.h

+ 3 - 1
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);

+ 4 - 1
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