From e7c0e06b5ea4b291bd627b5e1db415bb1cd89800 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Tue, 24 Sep 2024 13:50:35 -0400 Subject: [PATCH] SWDEV-486510 - Delete hip::Function object, in case compiler passes duplicate hostFunction ptr. Change-Id: Ic8714eb9022a0f2150b2ea5dc008cecd7a9fae27 --- hipamd/src/hip_code_object.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_code_object.cpp b/hipamd/src/hip_code_object.cpp index 723b947010..b2635c6b7e 100644 --- a/hipamd/src/hip_code_object.cpp +++ b/hipamd/src/hip_code_object.cpp @@ -1215,8 +1215,10 @@ hipError_t StatCO::registerStatFunction(const void* hostFunction, Function* func if (functions_.find(hostFunction) != functions_.end()) { DevLogPrintfError("hostFunctionPtr: 0x%x already exists", hostFunction); + delete func; + } else { + functions_.insert(std::make_pair(hostFunction, func)); } - functions_.insert(std::make_pair(hostFunction, func)); return hipSuccess; }