File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,21 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv)
45
45
instance = this ;
46
46
47
47
ur_loader_config_handle_t config;
48
- urLoaderConfigCreate (&config);
49
- urLoaderConfigEnableLayer (config, " UR_LAYER_FULL_VALIDATION" );
48
+ if (urLoaderConfigCreate (&config) == UR_RESULT_SUCCESS) {
49
+ if (urLoaderConfigEnableLayer (config, " UR_LAYER_FULL_VALIDATION" )) {
50
+ urLoaderConfigRelease (config);
51
+ error = " Failed to enable validation layer" ;
52
+ return ;
53
+ }
54
+ } else {
55
+ error = " Failed to create loader config handle" ;
56
+ return ;
57
+ }
50
58
51
59
ur_device_init_flags_t device_flags = 0 ;
52
- switch (urInit (device_flags, config)) {
60
+ auto initResult = urInit (device_flags, config);
61
+ auto configReleaseResult = urLoaderConfigRelease (config);
62
+ switch (initResult) {
53
63
case UR_RESULT_SUCCESS:
54
64
break ;
55
65
case UR_RESULT_ERROR_UNINITIALIZED:
@@ -59,7 +69,11 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv)
59
69
error = " urInit() failed" ;
60
70
return ;
61
71
}
62
- urLoaderConfigRelease (config);
72
+
73
+ if (configReleaseResult) {
74
+ error = " Failed to destroy loader config handle" ;
75
+ return ;
76
+ }
63
77
64
78
uint32_t count = 0 ;
65
79
if (urPlatformGet (0 , nullptr , &count)) {
You can’t perform that action at this time.
0 commit comments