[asterisk-commits] rmudgett: branch 10 r350221 - in /branches/10: ./ channels/chan_iax2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 9 15:55:08 CST 2012


Author: rmudgett
Date: Mon Jan  9 15:55:05 2012
New Revision: 350221

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=350221
Log:
Fix joinable thread terminating without joiner memory leak in chan_iax.c.

The iax2_process_thread() can exit without anyone waiting to join the
thread.  If noone is waiting to join the thread then a large memory leak
occurs.

* Made iax2_process_thread() deatach itself if nobody is waiting to join
the thread.

(closes issue ASTERISK-17339)
Reported by: Tzafrir Cohen
Patches:
      asterisk-1.8.4.4-chan_iax2-detach-thread-on-non-stop-exit.patch (license #5617) patch uploaded by Alex Villacis Lasso (modified)

(closes issue ASTERISK-17825)
Reported by: wangjin
........

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

Modified:
    branches/10/   (props changed)
    branches/10/channels/chan_iax2.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_iax2.c?view=diff&rev=350221&r1=350220&r2=350221
==============================================================================
--- branches/10/channels/chan_iax2.c (original)
+++ branches/10/channels/chan_iax2.c Mon Jan  9 15:55:05 2012
@@ -11850,7 +11850,8 @@
 		handle_deferred_full_frames(thread);
 	}
 
-	/*!\note For some reason, idle threads are exiting without being removed
+	/*!
+	 * \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.
 	 */
@@ -11861,6 +11862,11 @@
 	AST_LIST_LOCK(&dynamic_list);
 	AST_LIST_REMOVE(&dynamic_list, thread, list);
 	AST_LIST_UNLOCK(&dynamic_list);
+
+	if (!thread->stop) {
+		/* Nobody asked me to stop so nobody is waiting to join me. */
+		pthread_detach(pthread_self());
+	}
 
 	/* I am exiting here on my own volition, I need to clean up my own data structures
 	* Assume that I am no longer in any of the lists (idle, active, or dynamic)




More information about the asterisk-commits mailing list