chan_iax2: Fix stray reference to worker thread idle_list.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 5 Sep 2013 17:31:29 +0000 (17:31 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 5 Sep 2013 17:31:29 +0000 (17:31 +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.
........

Merged revisions 398416 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 398417 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 398418 from http://svn.asterisk.org/svn/asterisk/branches/12

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

channels/chan_iax2.c

index 3069bc9..4d8f6df 100644 (file)
@@ -11696,9 +11696,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);
@@ -14193,7 +14193,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;
@@ -14236,9 +14236,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);