[asterisk-commits] russell: trunk r179465 - /trunk/res/res_timing_timerfd.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 2 17:06:19 CST 2009


Author: russell
Date: Mon Mar  2 17:06:16 2009
New Revision: 179465

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=179465
Log:
Fix a reference leak in timerfd_set_rate().

(found during a debugging session with dvossel and mmichelson.)

Modified:
    trunk/res/res_timing_timerfd.c

Modified: trunk/res/res_timing_timerfd.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/res/res_timing_timerfd.c?view=diff&rev=179465&r1=179464&r2=179465
==============================================================================
--- trunk/res/res_timing_timerfd.c (original)
+++ trunk/res/res_timing_timerfd.c Mon Mar  2 17:06:16 2009
@@ -134,6 +134,7 @@
 	struct timerfd_timer *our_timer, find_helper = {
 		.handle = handle,
 	};
+	int res;
 
 	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
@@ -145,7 +146,11 @@
 	our_timer->saved_timer.it_interval.tv_sec = our_timer->saved_timer.it_value.tv_sec;
 	our_timer->saved_timer.it_interval.tv_nsec = our_timer->saved_timer.it_value.tv_nsec;
 
-	return timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
+	res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
+
+	ao2_ref(our_timer, -1);
+
+	return res;
 }
 
 static void timerfd_timer_ack(int handle, unsigned int quantity)




More information about the asterisk-commits mailing list