From f3664fd12452660f7305c234f307b9f2d62ec302 Mon Sep 17 00:00:00 2001 From: James Xu Date: Tue, 3 Sep 2024 14:41:46 -0400 Subject: [PATCH] rocr: Add nullptr check in IterateExecutables When an entry is deleted from the array, it's set to nullptr but not removed. Most other functions that iterate over the array check if the entry is nullptr but this loop in IterateExecutables did not. Change-Id: I763b361eea59f6df201bb86ead0234e95f2cf79c --- runtime/hsa-runtime/loader/executable.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/hsa-runtime/loader/executable.cpp b/runtime/hsa-runtime/loader/executable.cpp index a6ea83c335..4ad78c4a57 100644 --- a/runtime/hsa-runtime/loader/executable.cpp +++ b/runtime/hsa-runtime/loader/executable.cpp @@ -280,9 +280,11 @@ hsa_status_t AmdHsaCodeLoader::IterateExecutables( assert(callback); for (auto &exec : executables) { - hsa_status_t status = callback(Executable::Handle(exec), data); - if (status != HSA_STATUS_SUCCESS) { - return status; + if(exec != nullptr){ + hsa_status_t status = callback(Executable::Handle(exec), data); + if (status != HSA_STATUS_SUCCESS) { + return status; + } } }