Browse Source

fix fd leak

Samuel Thibault 9 years ago
parent
commit
6ec92c3148
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/drivers/opencl/driver_opencl_utils.c

+ 4 - 0
src/drivers/opencl/driver_opencl_utils.c

@@ -183,9 +183,13 @@ char *_starpu_opencl_load_program_binary(const char *filename, size_t *len)
 
 	binary = (char *) malloc(statbuf.st_size);
 	if (!binary)
+	{
+		fclose(fh);
 		return binary;
+	}
 
 	fread(binary, statbuf.st_size, 1, fh);
+	fclose(fh);
 
 	*len = statbuf.st_size;
 	return binary;