]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_iax2: Fix stray reference to worker thread idle_list.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 5 Sep 2013 17:28:14 +0000 (17:28 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 5 Sep 2013 17:28:14 +0000 (17:28 +0000)
* Fix stray reference to idle_list in cleanup_thread_list().  This may be
the reason for the note in iax2_process_thread() about threads not being
removed from the task lists.

* Move cleanup_thread_list(&idle_list) to after the other lists are
cleaned up.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@398416 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 3f5be0227ccf652fa3fb07d0cd99a8f52a6d0d19..5f7a5e9bf52d9c034199c166c1ac50ea56bc2b36 100644 (file)
@@ -11830,9 +11830,9 @@ static void *iax2_process_thread(void *data)
        }
 
        /*!
-        * \note For some reason, idle threads are exiting without being removed
-        * from an idle list, which is causing memory corruption.  Forcibly remove
-        * it from the list, if it's there.
+        * \note For some reason, idle threads are exiting without being
+        * removed from an idle list, which is causing memory
+        * corruption.  Forcibly remove it from the list, if it's there.
         */
        AST_LIST_LOCK(&idle_list);
        AST_LIST_REMOVE(&idle_list, thread, list);
@@ -14390,7 +14390,7 @@ static void cleanup_thread_list(void *head)
        struct iax2_thread *thread;
 
        AST_LIST_LOCK(list_head);
-       while ((thread = AST_LIST_REMOVE_HEAD(&idle_list, list))) {
+       while ((thread = AST_LIST_REMOVE_HEAD(list_head, list))) {
                pthread_t thread_id = thread->threadid;
 
                thread->stop = 1;
@@ -14432,9 +14432,9 @@ static int __unload_module(void)
        }
 
        /* Call for all threads to halt */
-       cleanup_thread_list(&idle_list);
        cleanup_thread_list(&active_list);
        cleanup_thread_list(&dynamic_list);
+       cleanup_thread_list(&idle_list);
 
        ast_netsock_release(netsock);
        ast_netsock_release(outsock);