[asterisk-commits] mmichelson: trunk r94477 - in /trunk: ./ main/dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 21 10:52:05 CST 2007


Author: mmichelson
Date: Fri Dec 21 10:52:04 2007
New Revision: 94477

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94477
Log:
Merged revisions 94468 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r94468 | mmichelson | 2007-12-21 10:49:35 -0600 (Fri, 21 Dec 2007) | 6 lines

Since we are freeing list elements within a list traversal, we need to use the safe
traversal and remove the item from the list before freeing it.

(closes issue 11612, reported by dtyoo)


........

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

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

Modified: trunk/main/dial.c
URL: http://svn.digium.com/view/asterisk/trunk/main/dial.c?view=diff&rev=94477&r1=94476&r2=94477
==============================================================================
--- trunk/main/dial.c (original)
+++ trunk/main/dial.c Fri Dec 21 10:52:04 2007
@@ -797,7 +797,7 @@
 		return -1;
 	
 	/* Hangup and deallocate all the dialed channels */
-	AST_LIST_TRAVERSE(&dial->channels, channel, list) {
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&dial->channels, channel, list) {
 		/* Disable any enabled options */
 		for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
 			if (!channel->options[i])
@@ -814,8 +814,10 @@
 		/* Free structure */
 		ast_free(channel->tech);
 		ast_free(channel->device);
+		AST_LIST_REMOVE_CURRENT(&dial->channels, list);
 		ast_free(channel);
 	}
+	AST_LIST_TRAVERSE_SAFE_END;
        
 	/* Disable any enabled options globally */
 	for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {




More information about the asterisk-commits mailing list