Use the correct list macros for deleting an item from the middle of a list.
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 16 Feb 2009 23:14:08 +0000 (23:14 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 16 Feb 2009 23:14:08 +0000 (23:14 +0000)
(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

channels/chan_skinny.c

index 654077e..fddd781 100644 (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);
 }