From 32a56184a88817091950a94335dbf1036677eaf1 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Wed, 23 Oct 2013 20:33:32 +0000 Subject: libhb: Plug some leaks and clean up the buffer pool code a little. Filters were leaking buffers when a job is cancelled. decavcodec could leak when job cancelled. decavcodec leaked audio extradata in BSInfo encavcodec and encavcodecaudio leaked AVCodecContext sync leaked subtitle_sanitizer_t data git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5853 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/sync.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libhb/sync.c') diff --git a/libhb/sync.c b/libhb/sync.c index c14d96166..f002434ce 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -227,6 +227,12 @@ static void InitSubtitle( hb_job_t * job, hb_sync_video_t * sync, int i ) } } +static void CloseSubtitle(hb_sync_video_t * sync, int ii) +{ + hb_buffer_close(&sync->subtitle_sanitizer[ii].list_current); + hb_buffer_close(&sync->subtitle_sanitizer[ii].last); +} + /*********************************************************************** * Close Video *********************************************************************** @@ -237,6 +243,7 @@ void syncVideoClose( hb_work_object_t * w ) hb_work_private_t * pv = w->private_data; hb_job_t * job = pv->job; hb_sync_video_t * sync = &pv->type.video; + int ii; // Wake up audio sync if it's still waiting on condition. pv->common->pts_offset = 0; @@ -266,6 +273,13 @@ void syncVideoClose( hb_work_object_t * w ) sync->drops, sync->dups ); } + int count = hb_list_count(job->list_subtitle); + for( ii = 0; ii < count; ii++ ) + { + CloseSubtitle(sync, ii); + } + free(sync->subtitle_sanitizer); + hb_lock( pv->common->mutex ); if ( --pv->common->ref == 0 ) { -- cgit v1.2.3