diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-24 02:16:59 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-24 02:16:59 +0000 |
commit | 9a2d00c6695ee1aea211fc811b3115f9f2a14b0f (patch) | |
tree | eabba9e78ed09558105184f6c9f5334c68b752f1 /res/res_timing_pthread.c | |
parent | 5afa4c787a3528cae64c1112cc86324803ec91ce (diff) |
fix a memory leak.
(inspired by, and potentially fixes issue #12917)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@124798 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_timing_pthread.c')
-rw-r--r-- | res/res_timing_pthread.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c index cb6bce439..f0a1d0e98 100644 --- a/res/res_timing_pthread.c +++ b/res/res_timing_pthread.c @@ -102,6 +102,7 @@ static struct { 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 @@ static int pthread_timer_open(void) 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 int check_timer(struct pthread_timer *timer) static void read_pipe(int rd_fd, unsigned int quantity, int clear) { - ast_assert(quantity || clear); if (!quantity && clear) { |