Skip to content

Commit 718c51e

Browse files
Merge pull request #1369 from IntelPython/fix-coverity-issue-in-dpctl-sycl-queue-interface
Addressed "Very high" Coverity issue: dereferencing null pointer
2 parents f49889c + dd6a014 commit 718c51e

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

libsyclinterface/source/dpctl_sycl_queue_interface.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ std::unique_ptr<property_list> create_property_list(int properties)
143143
propList =
144144
std::make_unique<property_list>(sycl::property::queue::in_order());
145145
}
146+
else {
147+
propList = std::make_unique<property_list>();
148+
}
146149

147150
if (_prop) {
148151
std::stringstream ss;
@@ -185,7 +188,7 @@ DPCTLQueue_Create(__dpctl_keep const DPCTLSyclContextRef CRef,
185188
}
186189
auto propList = create_property_list(properties);
187190

188-
if (propList && handler) {
191+
if (handler) {
189192
try {
190193
auto Queue = new queue(*ctx, *dev, DPCTL_AsyncErrorHandler(handler),
191194
*propList);
@@ -194,26 +197,9 @@ DPCTLQueue_Create(__dpctl_keep const DPCTLSyclContextRef CRef,
194197
error_handler(e, __FILE__, __func__, __LINE__);
195198
}
196199
}
197-
else if (properties) {
198-
try {
199-
auto Queue = new queue(*ctx, *dev, *propList);
200-
q = wrap<queue>(Queue);
201-
} catch (std::exception const &e) {
202-
error_handler(e, __FILE__, __func__, __LINE__);
203-
}
204-
}
205-
else if (handler) {
206-
try {
207-
auto Queue =
208-
new queue(*ctx, *dev, DPCTL_AsyncErrorHandler(handler));
209-
q = wrap<queue>(Queue);
210-
} catch (std::exception const &e) {
211-
error_handler(e, __FILE__, __func__, __LINE__);
212-
}
213-
}
214200
else {
215201
try {
216-
auto Queue = new queue(*ctx, *dev);
202+
auto Queue = new queue(*ctx, *dev, *propList);
217203
q = wrap<queue>(Queue);
218204
} catch (std::exception const &e) {
219205
error_handler(e, __FILE__, __func__, __LINE__);

0 commit comments

Comments
 (0)