Skip to content

Commit 48794f7

Browse files
author
Diptorup Deb
authored
Fix an issue identified by klockwork. (#478)
1 parent b38750d commit 48794f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dpctl-capi/source/dpctl_sycl_platform_interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ __dpctl_give DPCTLSyclPlatformRef DPCTLPlatform_CreateFromSelector(
8484
P = new platform(*DS);
8585
PRef = wrap(P);
8686
} catch (std::bad_alloc const &ba) {
87-
delete P;
8887
std::cerr << ba.what() << '\n';
88+
return nullptr;
8989
} catch (runtime_error const &re) {
9090
delete P;
9191
std::cerr << re.what() << '\n';
92+
return nullptr;
9293
}
9394
}
9495
else {

0 commit comments

Comments
 (0)