[asterisk-commits] mmichelson: trunk r201458 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 17 15:04:15 CDT 2009


Author: mmichelson
Date: Wed Jun 17 15:04:12 2009
New Revision: 201458

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201458
Log:
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.
........

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/channel.c?view=diff&rev=201458&r1=201457&r2=201458
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed Jun 17 15:04:12 2009
@@ -4835,10 +4835,14 @@
 	/* Move data stores over */
 	if (AST_LIST_FIRST(&clonechan->datastores)) {
 		struct ast_datastore *ds;
-		AST_LIST_TRAVERSE(&clonechan->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(&clonechan->datastores, ds, entry) {
 			if (ds->info->chan_fixup)
 				ds->info->chan_fixup(ds->data, clonechan, original);
 		}
+		AST_LIST_TRAVERSE_SAFE_END;
 		AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
 	}
 




More information about the asterisk-commits mailing list