diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-17 20:05:09 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-17 20:05:09 +0000 |
commit | 15048b5ac15426968a3e635fedd0c5a134a391ea (patch) | |
tree | f84931ce88743b11af0bc7b6f1df0c3cd854b832 /main/channel.c | |
parent | 0ca1888f89cec94021f24d14ce968c056bd0241b (diff) |
Merged revisions 201458 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r201458 | mmichelson | 2009-06-17 15:04:12 -0500 (Wed, 17 Jun 2009) | 15 lines
Merged revisions 201450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r201450 | mmichelson | 2009-06-17 14:59:31 -0500 (Wed, 17 Jun 2009) | 9 lines
Change the datastore traversal in ast_do_masquerade to use a safe list traversal.
It is possible for datastore fixup functions to remove the datastore from the list
and free it. In particular, the queue_transfer_fixup in app_queue does this. While
I don't yet know of this causing any crashes, it certainly could.
Found while discussing a separate issue with Brian Degenhardt.
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@201459 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 6 |
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); } |