aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index ddeee3310..8da9d33b4 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -4403,10 +4403,14 @@ int ast_do_masquerade(struct ast_channel *original)
/* Move data stores over */
if (AST_LIST_FIRST(&clone->datastores)) {
struct ast_datastore *ds;
- AST_LIST_TRAVERSE(&clone->datastores, ds, entry) {
+ /* We use a safe traversal here because some fixup routines actually
+ * remove the datastore from the list and free them.
+ */
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&clone->datastores, ds, entry) {
if (ds->info->chan_fixup)
ds->info->chan_fixup(ds->data, clone, original);
}
+ AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_APPEND_LIST(&original->datastores, &clone->datastores, entry);
}