aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/channel.c6
-rw-r--r--main/pbx.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 77a790802..2596a0037 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1360,6 +1360,11 @@ void ast_channel_free(struct ast_channel *chan)
/* Destroy the jitterbuffer */
ast_jb_destroy(chan);
+
+ if (chan->cdr) {
+ ast_cdr_free(chan->cdr);
+ chan->cdr = NULL;
+ }
ast_mutex_destroy(&chan->lock_dont_use);
@@ -1642,6 +1647,7 @@ int ast_hangup(struct ast_channel *chan)
ast_cdr_end(chan->cdr);
ast_cdr_detach(chan->cdr);
+ chan->cdr = NULL;
}
ast_channel_free(chan);
diff --git a/main/pbx.c b/main/pbx.c
index db4a79552..59ba133e8 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7087,6 +7087,7 @@ static int ast_pbx_outgoing_cdr_failed(void)
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 */