We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7ecf64d + 78947c1 commit 6fb5582Copy full SHA for 6fb5582
source/adapters/cuda/event.cpp
@@ -290,8 +290,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle(
290
291
std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr};
292
293
- *phEvent = ur_event_handle_t_::makeWithNative(
294
- hContext, reinterpret_cast<CUevent>(hNativeEvent));
+ try {
+ EventPtr =
295
+ std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeWithNative(
296
+ hContext, reinterpret_cast<CUevent>(hNativeEvent)));
297
+ } catch (const std::bad_alloc &) {
298
+ return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
299
+ } catch (...) {
300
+ return UR_RESULT_ERROR_UNKNOWN;
301
+ }
302
+
303
+ *phEvent = EventPtr.release();
304
305
return UR_RESULT_SUCCESS;
306
}
0 commit comments