Skip to content

Commit 709e467

Browse files
committed
Feedback: Security on handle type changes.
1 parent 090bd42 commit 709e467

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

source/adapters/cuda/image.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp(
461461
UR_CHECK_ERROR(cuArray3DCreate(&ImageArray, &array_desc));
462462
*phImageMem = (ur_exp_image_mem_native_handle_t)ImageArray;
463463
} catch (ur_result_t Err) {
464-
if (ImageArray) {
464+
if (ImageArray != CUarray{}) {
465465
UR_CHECK_ERROR(cuArrayDestroy(ImageArray));
466466
}
467467
return Err;
468468
} catch (...) {
469-
if (ImageArray) {
469+
if (ImageArray != CUarray{}) {
470470
UR_CHECK_ERROR(cuArrayDestroy(ImageArray));
471471
}
472472
return UR_RESULT_ERROR_UNKNOWN;

source/adapters/cuda/memory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,12 @@ ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem,
465465
UR_CHECK_ERROR(cuSurfObjectCreate(&Surface, &ImageResDesc));
466466
Image.SurfObjs[DeviceIdx] = Surface;
467467
} catch (ur_result_t Err) {
468-
if (ImageArray) {
468+
if (ImageArray != CUarray{}) {
469469
UR_CHECK_ERROR(cuArrayDestroy(ImageArray));
470470
}
471471
return Err;
472472
} catch (...) {
473-
if (ImageArray) {
473+
if (ImageArray != CUarray{}) {
474474
UR_CHECK_ERROR(cuArrayDestroy(ImageArray));
475475
}
476476
return UR_RESULT_ERROR_UNKNOWN;

0 commit comments

Comments
 (0)