From: Joshua Colp Date: Sun, 15 Feb 2015 12:39:09 +0000 (+0000) Subject: res_timing_pthread: Fix leaky pipes. X-Git-Tag: 13.3.0-rc1~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce70587ba61f834af81e81bdee52badcdc493f18;p=thirdparty%2Fasterisk.git res_timing_pthread: Fix leaky pipes. During some refactoring the way private information for timers was stored was changed. As a result of this the action which normally removed the timer upon closure in res_timing_pthread was also removed causing the timer to remain after it should using up resources. This change ensures that the timer is removed upon closure. ASTERISK-24768 #close Reported by: Matthias Urlichs patches: timer.patch submitted by Matthias Urlichs (license 5508) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431807 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c index 81efbf8e7c..1e76720ecd 100644 --- a/res/res_timing_pthread.c +++ b/res/res_timing_pthread.c @@ -143,7 +143,7 @@ static void *pthread_timer_open(void) ast_cond_signal(&timing_thread.cond); ast_mutex_unlock(&timing_thread.lock); } - ao2_link(pthread_timers, timer); + ao2_link_flags(pthread_timers, timer, OBJ_NOLOCK); ao2_unlock(pthread_timers); return timer; @@ -153,6 +153,7 @@ static void pthread_timer_close(void *data) { struct pthread_timer *timer = data; + ao2_unlink(pthread_timers, timer); ao2_ref(timer, -1); }