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.
1 parent 8499b57 commit c4ae460Copy full SHA for c4ae460
source/adapters/cuda/event.cpp
@@ -283,8 +283,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle(
283
284
std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr};
285
286
- *phEvent = ur_event_handle_t_::makeWithNative(
287
- hContext, reinterpret_cast<CUevent>(hNativeEvent));
+ try {
+ EventPtr =
288
+ std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeWithNative(
289
+ hContext, reinterpret_cast<CUevent>(hNativeEvent)));
290
+ } catch (const std::bad_alloc &) {
291
+ return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
292
+ } catch (...) {
293
+ return UR_RESULT_ERROR_UNKNOWN;
294
+ }
295
+
296
+ *phEvent = EventPtr.release();
297
298
return UR_RESULT_SUCCESS;
299
}
0 commit comments