From 171df16dea1d2c6215b6aa50a49157cf253f502f Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 23 Sep 2015 12:43:41 +0200 Subject: [PATCH] tm: more debug info when freeing a transaction - attempt to catch a double free (cherry picked from commit ef44e5b8b4292f4c4ff3a77e46bbb33e5e0f077f) --- modules/tm/h_table.c | 4 +++- modules/tm/h_table.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c index e3bc1b4a5cd..c38885ad932 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 db352123553..9340e5b7554 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