File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -330,8 +330,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle(
330330 ur_event_handle_t *phEvent) {
331331 std::ignore = pProperties;
332332
333- *phEvent = ur_event_handle_t_::makeWithNative (
334- hContext, reinterpret_cast <hipEvent_t>(hNativeEvent));
333+ std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr };
334+
335+ try {
336+ EventPtr =
337+ std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeWithNative (
338+ hContext, reinterpret_cast <hipEvent_t>(hNativeEvent)));
339+ } catch (const std::bad_alloc &) {
340+ return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
341+ } catch (...) {
342+ return UR_RESULT_ERROR_UNKNOWN;
343+ }
344+
345+ *phEvent = EventPtr.release ();
335346
336347 return UR_RESULT_SUCCESS;
337348}
You can’t perform that action at this time.
0 commit comments