Fix memory leak

getLastQueuedCommand(true) will implictly retain the last command, hence if we're not putting it in the waitlist, we should release it.

Change-Id: I1ad4ddcdf1df5237b83e1ea2447eb39a59f7dc3a


[ROCm/hip commit: 61b84e246c]
This commit is contained in:
Vladislav Sytchenko
2020-08-26 12:44:01 -04:00
committed by Vladislav Sytchenko
parent 088512e3f6
commit 02913e98a3
+7 -4
View File
@@ -159,10 +159,13 @@ void iHipWaitActiveStreams(amd::HostQueue* blocking_queue, bool wait_null_stream
(stream->Null() == wait_null_stream)) {
// Get the last valid command
amd::Command* command = active_queue->getLastQueuedCommand(true);
if ((command != nullptr) &&
// Check the current active status
(command->status() != CL_COMPLETE)) {
eventWaitList.push_back(command);
if (command != nullptr) {
// Check the current active status
if (command->status() != CL_COMPLETE) {
eventWaitList.push_back(command);
} else {
command->release();
}
}
}
}