[svn-commits] mmichelson: branch 1.4 r201450 - /branches/1.4/main/channel.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 17 14:59:35 CDT 2009
Author: mmichelson
Date: Wed Jun 17 14:59:31 2009
New Revision: 201450
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201450
Log:
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.
Modified:
branches/1.4/main/channel.c
Modified: branches/1.4/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/channel.c?view=diff&rev=201450&r1=201449&r2=201450
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Wed Jun 17 14:59:31 2009
@@ -3888,10 +3888,14 @@
/* 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);
}
More information about the svn-commits
mailing list