[svn-commits] russell: trunk r124798 - /trunk/res/res_timing_pthread.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 23 21:17:01 CDT 2008


Author: russell
Date: Mon Jun 23 21:16:59 2008
New Revision: 124798

URL: http://svn.digium.com/view/asterisk?view=rev&rev=124798
Log:
fix a memory leak.

(inspired by, and potentially fixes issue #12917)

Modified:
    trunk/res/res_timing_pthread.c

Modified: trunk/res/res_timing_pthread.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_timing_pthread.c?view=diff&rev=124798&r1=124797&r2=124798
==============================================================================
--- trunk/res/res_timing_pthread.c (original)
+++ trunk/res/res_timing_pthread.c Mon Jun 23 21:16:59 2008
@@ -102,6 +102,7 @@
 static int pthread_timer_open(void)
 {
 	struct pthread_timer *timer;
+	int fd;
 
 	if (!(timer = ao2_alloc(sizeof(*timer), pthread_timer_destructor))) {
 		errno = ENOMEM;
@@ -125,7 +126,11 @@
 	ao2_link(pthread_timers, timer);
 	ao2_unlock(pthread_timers);
 
-	return timer->pipe[PIPE_READ];
+	fd = timer->pipe[PIPE_READ];
+
+	ao2_ref(timer, -1);
+
+	return fd;
 }
 
 static void pthread_timer_close(int handle)
@@ -326,7 +331,6 @@
 
 static void read_pipe(int rd_fd, unsigned int quantity, int clear)
 {
-
 	ast_assert(quantity || clear);
 
 	if (!quantity && clear) {




More information about the svn-commits mailing list