From 27c5b91e916e51c0d44dc0fd111feca43a4ea481 Mon Sep 17 00:00:00 2001 From: maxd Date: Wed, 8 Mar 2017 20:08:32 +0100 Subject: [PATCH] opencl: Fix resource leak. Closes #617 and closes #618. --- libhb/openclwrapper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libhb/openclwrapper.c b/libhb/openclwrapper.c index c906f68f9..52b052519 100644 --- a/libhb/openclwrapper.c +++ b/libhb/openclwrapper.c @@ -130,12 +130,14 @@ int hb_convert_to_string( const char *filename, char **source, GPUEnv *gpu_info, *source = (char*)malloc( sizeof(char) * file_size + 1 ); if( *source == (char*)NULL ) { + fclose( file ); return(0); } result = fread( *source, 1, file_size, file ); if( result != file_size ) { free( *source ); + fclose( file ); return(0); } (*source)[file_size] = '\0'; -- 2.40.0