From 03414e20ee318e3bbbbd787863cba778367c0b58 Mon Sep 17 00:00:00 2001 From: "Saeed, Oosman" Date: Tue, 15 Jul 2025 14:33:27 -0500 Subject: [PATCH] SWDEV-539482: Different sizes of mem leaks observed in amdsmitst (#538) Signed-off-by:Oosman Saeed --- src/amd_smi/amd_smi_system.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/amd_smi/amd_smi_system.cc b/src/amd_smi/amd_smi_system.cc index abc1930d66..df47eca38f 100644 --- a/src/amd_smi/amd_smi_system.cc +++ b/src/amd_smi/amd_smi_system.cc @@ -397,15 +397,16 @@ amdsmi_status_t AMDSmiSystem::cleanup() { processors_.clear(); sockets_.clear(); esmi_exit(); - init_flag_ &= ~AMDSMI_INIT_AMD_CPUS; } #endif if (init_flag_ & AMDSMI_INIT_AMD_GPUS) { - // we do not need to delete the sockets/processors, clear takes care of this + // we do not need to delete the processors, deleting sockets takes care of this if (!processors_.empty()) {processors_.clear();} + for (uint32_t i = 0; i < sockets_.size(); i++) { + delete sockets_[i]; + } if (!sockets_.empty()) {sockets_.clear();} drm_.cleanup(); - init_flag_ &= ~AMDSMI_INIT_AMD_GPUS; rsmi_status_t ret = rsmi_shut_down(); if (ret != RSMI_STATUS_SUCCESS) { return amd::smi::rsmi_to_amdsmi_status(ret);