diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index fd2891531f..da1cf091b1 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -363,8 +363,9 @@ AqlQueue::~AqlQueue() { } Inactivate(); - agent_->ReleaseQueueMainScratch(queue_scratch_); - agent_->ReleaseQueueAltScratch(queue_scratch_); + + if (queue_scratch_.main_queue_base) agent_->ReleaseQueueMainScratch(queue_scratch_); + if (queue_scratch_.alt_queue_base) agent_->ReleaseQueueAltScratch(queue_scratch_); FreeRegisteredRingBuffer(); exception_signal_->DestroySignal();