mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@94468 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -681,7 +681,7 @@ int ast_dial_destroy(struct ast_dial *dial)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Hangup and deallocate all the dialed channels */
|
/* 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 */
|
/* Disable any enabled options */
|
||||||
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
|
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
|
||||||
if (!channel->options[i])
|
if (!channel->options[i])
|
||||||
@@ -696,8 +696,10 @@ int ast_dial_destroy(struct ast_dial *dial)
|
|||||||
channel->owner = NULL;
|
channel->owner = NULL;
|
||||||
}
|
}
|
||||||
/* Free structure */
|
/* Free structure */
|
||||||
|
AST_LIST_REMOVE_CURRENT(&dial->channels, list);
|
||||||
free(channel);
|
free(channel);
|
||||||
}
|
}
|
||||||
|
AST_LIST_TRAVERSE_SAFE_END;
|
||||||
|
|
||||||
/* Disable any enabled options globally */
|
/* Disable any enabled options globally */
|
||||||
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
|
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
|
||||||
|
Reference in New Issue
Block a user