--- asterisk-1.6.0-rc2/main/channel.c 2008-08-29 13:02:17.000000000 +0200 +++ build/asterisk-1.6.0-rc2/main/channel.c 2008-08-29 17:34:57.000000000 +0200 @@ -1345,6 +1345,11 @@ /* Destroy the jitterbuffer */ ast_jb_destroy(chan); + + if (chan->cdr) { + ast_cdr_detach(chan->cdr); + chan->cdr = NULL; + } ast_mutex_destroy(&chan->lock_dont_use); @@ -1657,6 +1662,7 @@ ast_cdr_end(chan->cdr); ast_cdr_detach(chan->cdr); + chan->cdr = NULL; } ast_channel_free(chan); --- asterisk-1.6.0-rc2/main/pbx.c 2008-08-29 17:35:09.000000000 +0200 +++ build/asterisk-1.6.0-rc2/main/pbx.c 2008-08-29 17:36:29.000000000 +0200 @@ -6966,6 +6966,7 @@ ast_cdr_end(chan->cdr); ast_cdr_failed(chan->cdr); /* set the status to failed */ ast_cdr_detach(chan->cdr); /* post and free the record */ + chan->cdr = NULL; ast_channel_free(chan); /* free the channel */ return 0; /* success */