summaryrefslogtreecommitdiffstats
path: root/libhb/work.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-02-12 21:38:34 +0000
committerjstebbins <[email protected]>2011-02-12 21:38:34 +0000
commit8bf55ae1a275b3576971c4596c4b0b1090902364 (patch)
tree754846425d4660147e7d658cf500359c7298866d /libhb/work.c
parent335e7e305d59063132ddae2fff76e7c6c7b02d47 (diff)
plug some memory leaks.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3797 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/work.c')
-rw-r--r--libhb/work.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libhb/work.c b/libhb/work.c
index 045f5b9bb..e3d094542 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -984,10 +984,10 @@ static void do_job( hb_job_t * job, int cpu_count )
w = muxer;
}
+ hb_buffer_t * buf_in, * buf_out;
+
while ( !*job->die && !*w->done && w->status != HB_WORK_DONE )
{
- hb_buffer_t * buf_in, * buf_out;
-
buf_in = hb_fifo_get_wait( w->fifo_in );
if ( buf_in == NULL )
continue;
@@ -1018,12 +1018,18 @@ static void do_job( hb_job_t * job, int cpu_count )
if ( hb_fifo_full_wait( w->fifo_out ) )
{
hb_fifo_push( w->fifo_out, buf_out );
+ buf_out = NULL;
break;
}
}
}
}
+ if ( buf_out )
+ {
+ hb_buffer_close( &buf_out );
+ }
+
hb_handle_t * h = job->h;
hb_state_t state;
hb_get_state( h, &state );
@@ -1253,11 +1259,17 @@ static void work_loop( void * _w )
if ( hb_fifo_full_wait( w->fifo_out ) )
{
hb_fifo_push( w->fifo_out, buf_out );
+ buf_out = NULL;
break;
}
}
}
}
+ if ( buf_out )
+ {
+ hb_buffer_close( &buf_out );
+ }
+
// Consume data in incoming fifo till job complete so that
// residual data does not stall the pipeline
while( !*w->done )