Skip to content

Commit d08fc6a

Browse files
committed
Coverity: Fix 1594027 Uncaught exception
The `UR_CHECK_ERROR()` utility macro in the CUDA adapter calls the `checkErrorUR()` utility function, this throws a `ur_result_t` which was not being caught.
1 parent 669797f commit d08fc6a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/adapters/cuda/memory.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,14 @@ struct ur_mem_handle_t_ {
409409
}
410410

411411
ur_result_t clear() {
412-
if (isBuffer()) {
413-
return std::get<BufferMem>(Mem).clear();
412+
try {
413+
if (isBuffer()) {
414+
return std::get<BufferMem>(Mem).clear();
415+
}
416+
return std::get<SurfaceMem>(Mem).clear();
417+
} catch (const ur_result_t &error) {
418+
return error;
414419
}
415-
return std::get<SurfaceMem>(Mem).clear();
416420
}
417421

418422
ur_context_handle_t getContext() const noexcept { return Context; }

0 commit comments

Comments
 (0)