Skip to content

Commit

Permalink
Merge pull request #2452 from winstonzhang-intel/urlza-414
Browse files Browse the repository at this point in the history
[L0] Fixed event leak when outevent is given and is completed
  • Loading branch information
kbenzie committed Dec 16, 2024
1 parent 3894890 commit b6bf765
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ ur_result_t urEnqueueEventsWait(
std::unique_lock<ur_shared_mutex> Lock(Queue->Mutex);
resetCommandLists(Queue);
}
if (OutEvent && (*OutEvent)->Completed) {
UR_CALL(CleanupCompletedEvent((*OutEvent), false, false));
UR_CALL(urEventReleaseInternal((*OutEvent)));
}

return UR_RESULT_SUCCESS;
}
Expand Down Expand Up @@ -955,7 +959,6 @@ ur_result_t urEventCreateWithNativeHandle(
UREvent = new ur_event_handle_t_(ZeEvent, nullptr /* ZeEventPool */,
Context, UR_EXT_COMMAND_TYPE_USER,
Properties->isNativeHandleOwned);

UREvent->RefCountExternal++;

} catch (const std::bad_alloc &) {
Expand Down

0 comments on commit b6bf765

Please sign in to comment.