Use the correct list macros for deleting an item from the middle of a list.

(issue #13777)
 Reported by: pj
 Patches: 
       20090203__bug13777.diff.txt uploaded by Corydon76 (license 14)
 Tested by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176320 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-02-16 23:14:08 +00:00
parent 0381d94d14
commit 808047d54b

View File

@@ -5869,9 +5869,9 @@ static void destroy_session(struct skinnysession *s)
{
struct skinnysession *cur;
AST_LIST_LOCK(&sessions);
AST_LIST_TRAVERSE(&sessions, cur, list) {
AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
if (cur == s) {
AST_LIST_REMOVE(&sessions, s, list);
AST_LIST_REMOVE_CURRENT(list);
if (s->fd > -1)
close(s->fd);
@@ -5882,6 +5882,7 @@ static void destroy_session(struct skinnysession *s)
ast_log(LOG_WARNING, "Trying to delete nonexistent session %p?\n", s);
}
}
AST_LIST_TRAVERSE_SAFE_END
AST_LIST_UNLOCK(&sessions);
}