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