Skip to content

Addressed "Very high" Coverity issue: dereferencing null pointer #1369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions libsyclinterface/source/dpctl_sycl_queue_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ std::unique_ptr<property_list> create_property_list(int properties)
propList =
std::make_unique<property_list>(sycl::property::queue::in_order());
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not aware SYCL runtime allows an empty property_list. The change is good.

propList = std::make_unique<property_list>();
}

if (_prop) {
std::stringstream ss;
Expand Down Expand Up @@ -185,7 +188,7 @@ DPCTLQueue_Create(__dpctl_keep const DPCTLSyclContextRef CRef,
}
auto propList = create_property_list(properties);

if (propList && handler) {
if (handler) {
try {
auto Queue = new queue(*ctx, *dev, DPCTL_AsyncErrorHandler(handler),
*propList);
Expand All @@ -194,26 +197,9 @@ DPCTLQueue_Create(__dpctl_keep const DPCTLSyclContextRef CRef,
error_handler(e, __FILE__, __func__, __LINE__);
}
}
else if (properties) {
try {
auto Queue = new queue(*ctx, *dev, *propList);
q = wrap<queue>(Queue);
} catch (std::exception const &e) {
error_handler(e, __FILE__, __func__, __LINE__);
}
}
else if (handler) {
try {
auto Queue =
new queue(*ctx, *dev, DPCTL_AsyncErrorHandler(handler));
q = wrap<queue>(Queue);
} catch (std::exception const &e) {
error_handler(e, __FILE__, __func__, __LINE__);
}
}
else {
try {
auto Queue = new queue(*ctx, *dev);
auto Queue = new queue(*ctx, *dev, *propList);
q = wrap<queue>(Queue);
} catch (std::exception const &e) {
error_handler(e, __FILE__, __func__, __LINE__);
Expand Down