diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-21 16:49:35 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-21 16:49:35 +0000 |
commit | 4c2a51057eb2498853676592e06666e33d4491da (patch) | |
tree | 9ef648b17f2f9a4805148704e97ae4b999515341 /main/dial.c | |
parent | e426b0755d17a7965b74633832bf7d450600722f (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@94468 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/dial.c')
-rw-r--r-- | main/dial.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/dial.c b/main/dial.c index 32004c055..02bf03e22 100644 --- a/main/dial.c +++ b/main/dial.c @@ -681,7 +681,7 @@ int ast_dial_destroy(struct ast_dial *dial) 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 @@ int ast_dial_destroy(struct ast_dial *dial) 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++) { |