diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 15:40:24 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 15:40:24 +0000 |
commit | 7ff1c4d4ac996bec20994ed1a86e45323e5b9059 (patch) | |
tree | 723b805c59ff8c38f116fe57caedc64f1466f220 /res | |
parent | 1c8a8a2f048a0d9ab1f722c67bf79ec2aa1d48ba (diff) |
Ensure that the stored CDR reference is still valid after the bridge before
poking at it. Also, keep the channel locked while messing with this CDR.
(fixes crashes reported in issue #13409)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@142063 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_features.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/res/res_features.c b/res/res_features.c index 24b0a46b2..475c7711c 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1678,6 +1678,22 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast ast_cdr_specialized_reset(chan->cdr,0); } if (peer->cdr) { + struct ast_cdr *cur; + + ast_channel_lock(peer); + for (cur = peer->cdr; cur; cur = cur->next) { + if (cur == orig_peer_cdr) { + break; + } + } + + if (!cur) { + /* orig_peer_cdr is gone, probably because of a masquerade + * during the bridge. */ + ast_channel_unlock(peer); + return res; + } + /* before resetting the peer cdr, throw a copy of it to the backend, just in case the cdr.conf file is calling for unanswered CDR's. */ @@ -1694,6 +1710,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast } } ast_cdr_specialized_reset(orig_peer_cdr,0); + ast_channel_unlock(peer); } } return res; |