summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaxd <[email protected]>2017-03-08 20:08:32 +0100
committerBradley Sepos <[email protected]>2017-03-08 14:12:46 -0500
commit27c5b91e916e51c0d44dc0fd111feca43a4ea481 (patch)
tree652499c30cb1cf5ce6c3eef6b971994245142766
parentacf986e8df2e8084f50d684a0aa98329f8c77cab (diff)
opencl: Fix resource leak.
Closes #617 and closes #618.
-rw-r--r--libhb/openclwrapper.c2
1 files changed, 2 insertions, 0 deletions
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';