diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-21 16:52:04 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-21 16:52:04 +0000 |
commit | 4b0258fbbe85e074197c18beb0b084e7600f7854 (patch) | |
tree | 8d00ed908e187e5c14becf80b3c682b67be73e42 /main/dial.c | |
parent | 6aaafa095ca57d8deedb1cea7f2935d9ee4ed306 (diff) |
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)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@94477 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 2766292ac..26ffc1375 100644 --- a/main/dial.c +++ b/main/dial.c @@ -797,7 +797,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]) @@ -814,8 +814,10 @@ int ast_dial_destroy(struct ast_dial *dial) /* 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++) { |