[asterisk-commits] mmichelson: branch 1.4 r94468 - /branches/1.4/main/dial.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 21 10:49:35 CST 2007
Author: mmichelson
Date: Fri Dec 21 10:49:35 2007
New Revision: 94468
URL: http://svn.digium.com/view/asterisk?view=rev&rev=94468
Log:
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:
branches/1.4/main/dial.c
Modified: branches/1.4/main/dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/dial.c?view=diff&rev=94468&r1=94467&r2=94468
==============================================================================
--- branches/1.4/main/dial.c (original)
+++ branches/1.4/main/dial.c Fri Dec 21 10:49:35 2007
@@ -681,7 +681,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])
@@ -696,8 +696,10 @@
channel->owner = NULL;
}
/* Free structure */
+ AST_LIST_REMOVE_CURRENT(&dial->channels, list);
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