aboutsummaryrefslogtreecommitdiffstats
path: root/main/features.c
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-09 20:48:44 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-09 20:48:44 +0000
commit6e786e8720482f13a093d01d56a4d6926d71cb59 (patch)
tree8ef5bfa8ebafdbeb0aa0da5fbaf16b904c52ee42 /main/features.c
parent21fba4ca4720350d38a86c026e25b6b6602d455c (diff)
Don't crash after Set(CDR(userfield)=...) in ast_bridge_call
Instead of setting peer->cdr = NULL, set it to not post. (closes issue #18415) Reported by: macbrody Patches: patch-18415 uploaded by jsolares (license 1167) Tested by: jsolares, twilson git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@297952 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/features.c b/main/features.c
index 2c9954c24..220a6eb11 100644
--- a/main/features.c
+++ b/main/features.c
@@ -3091,6 +3091,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
int hasfeatures=0;
int hadfeatures=0;
int autoloopflag;
+ int we_disabled_peer_cdr = 0;
struct ast_option_header *aoh;
struct ast_cdr *bridge_cdr = NULL;
struct ast_cdr *orig_peer_cdr = NULL;
@@ -3158,9 +3159,9 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
ast_cdr_appenduserfield(chan, tmp);
} else
ast_cdr_setuserfield(chan, peer->cdr->userfield);
- /* free the peer's cdr without ast_cdr_free complaining */
- ast_free(peer->cdr);
- peer->cdr = NULL;
+ /* Don't delete the CDR; just disable it. */
+ ast_set_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED);
+ we_disabled_peer_cdr = 1;
}
ast_copy_string(orig_channame,chan->name,sizeof(orig_channame));
ast_copy_string(orig_peername,peer->name,sizeof(orig_peername));
@@ -3600,6 +3601,9 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
ast_cdr_specialized_reset(new_peer_cdr, 0);
}
} else {
+ if (we_disabled_peer_cdr) {
+ ast_clear_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED);
+ }
ast_cdr_specialized_reset(peer->cdr, 0); /* nothing changed, reset the peer cdr */
}
}