File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -455,32 +455,40 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp(
455
455
456
456
// Allocate a cuArray
457
457
if (pImageDesc->numMipLevel == 1 ) {
458
- CUarray ImageArray;
458
+ CUarray ImageArray{} ;
459
459
460
460
try {
461
461
UR_CHECK_ERROR (cuArray3DCreate (&ImageArray, &array_desc));
462
462
*phImageMem = (ur_exp_image_mem_native_handle_t )ImageArray;
463
463
} catch (ur_result_t Err) {
464
- cuArrayDestroy (ImageArray);
464
+ if (ImageArray) {
465
+ UR_CHECK_ERROR (cuArrayDestroy (ImageArray));
466
+ }
465
467
return Err;
466
468
} catch (...) {
467
- cuArrayDestroy (ImageArray);
469
+ if (ImageArray) {
470
+ UR_CHECK_ERROR (cuArrayDestroy (ImageArray));
471
+ }
468
472
return UR_RESULT_ERROR_UNKNOWN;
469
473
}
470
474
} else // Allocate a cuMipmappedArray
471
475
{
472
- CUmipmappedArray mip_array;
476
+ CUmipmappedArray mip_array{} ;
473
477
array_desc.Flags = CUDA_ARRAY3D_SURFACE_LDST;
474
478
475
479
try {
476
480
UR_CHECK_ERROR (cuMipmappedArrayCreate (&mip_array, &array_desc,
477
481
pImageDesc->numMipLevel ));
478
482
*phImageMem = (ur_exp_image_mem_native_handle_t )mip_array;
479
483
} catch (ur_result_t Err) {
480
- cuMipmappedArrayDestroy (mip_array);
484
+ if (mip_array) {
485
+ UR_CHECK_ERROR (cuMipmappedArrayDestroy (mip_array));
486
+ }
481
487
return Err;
482
488
} catch (...) {
483
- cuMipmappedArrayDestroy (mip_array);
489
+ if (mip_array) {
490
+ UR_CHECK_ERROR (cuMipmappedArrayDestroy (mip_array));
491
+ }
484
492
return UR_RESULT_ERROR_UNKNOWN;
485
493
}
486
494
}
Original file line number Diff line number Diff line change @@ -439,7 +439,7 @@ ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem,
439
439
UR_CHECK_ERROR (cuMemAlloc (&DevPtr, Buffer.Size ));
440
440
}
441
441
} else {
442
- CUarray ImageArray;
442
+ CUarray ImageArray{} ;
443
443
CUsurfObject Surface;
444
444
try {
445
445
auto &Image = std::get<SurfaceMem>(Mem->Mem );
Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem,
498
498
UR_CHECK_ERROR (hipMalloc (&DevPtr, Buffer.Size ));
499
499
}
500
500
} else {
501
- hipArray *ImageArray;
501
+ hipArray *ImageArray{} ;
502
502
hipSurfaceObject_t Surface;
503
503
try {
504
504
auto &Image = std::get<SurfaceMem>(Mem->Mem );
You can’t perform that action at this time.
0 commit comments