From: maxd Date: Wed, 8 Mar 2017 19:08:32 +0000 (+0100) Subject: opencl: Fix resource leak. X-Git-Tag: 1.1.0~657 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27c5b91e916e51c0d44dc0fd111feca43a4ea481;p=handbrake opencl: Fix resource leak. Closes #617 and closes #618. --- 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';