aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-14 16:25:09 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-14 16:25:09 +0000
commitebaed1af0352d82cf200a2a324611a9c92617551 (patch)
tree62ec254bf112d6a516e03d939077f3c086e77184 /apps/app_queue.c
parent730161f52d94207e2a0327b6960fdde712f8bc82 (diff)
Merged revisions 114112 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r114112 | mmichelson | 2008-04-14 11:24:22 -0500 (Mon, 14 Apr 2008) | 9 lines If the datastore has been moved to another channel due to a masquerade, then freeing the datastore here causes an eventual double free when the new channel hangs up. We should only free the datastore if we were able to successfully remove it from the channel we are referencing (i.e. the datastore was not moved). (closes issue #12359) Reported by: pguido ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114113 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 7f01445df..aef06aa2d 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3252,8 +3252,13 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
if (use_weight)
ao2_unlock(queues);
lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
- if (datastore) {
- ast_channel_datastore_remove(qe->chan, datastore);
+ /* The ast_channel_datastore_remove() function could fail here if the
+ * datastore was moved to another channel during a masquerade. If this is
+ * the case, don't free the datastore here because later, when the channel
+ * to which the datastore was moved hangs up, it will attempt to free this
+ * datastore again, causing a crash
+ */
+ if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
ast_channel_datastore_free(datastore);
}
ao2_lock(qe->parent);