From 514fc4f4ac4312d25680c1fd6c4eab25c5b2551a Mon Sep 17 00:00:00 2001 From: maxd Date: Thu, 9 Feb 2017 21:04:59 +0100 Subject: [PATCH] opencl: better release of OpenCL context to avoid more leaks --- libhb/cropscale.c | 4 ++++ libhb/work.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/libhb/cropscale.c b/libhb/cropscale.c index cdce872d9..b64154377 100644 --- a/libhb/cropscale.c +++ b/libhb/cropscale.c @@ -142,6 +142,10 @@ static void hb_crop_scale_close( hb_filter_object_t * filter ) { HB_OCL_BUF_FREE(hb_ocl, pv->os->bicubic_x_weights); HB_OCL_BUF_FREE(hb_ocl, pv->os->bicubic_y_weights); + if (pv->os->initialized == 1) + { + hb_ocl->clReleaseKernel(pv->os->m_kernel); + } } free(pv->os); } diff --git a/libhb/work.c b/libhb/work.c index 9010f1d3a..ad11ee005 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -1838,6 +1838,12 @@ cleanup: } hb_buffer_pool_free(); + + if (job->use_opencl) + { + hb_release_opencl_run_env(); + } + hb_job_close(&job); } -- 2.40.0