kfdtest: fix resource leakage
Resource allocated in SetUp/HsaNodeInfo::Init, needs be delete in TearDown/HsaNodeInfo::Delete. Signed-off-by: James Zhu <James.Zhu@amd.com>
This commit is contained in:
committed by
Zhu, James
orang tua
322a794cf6
melakukan
f8d8b8011f
@@ -166,6 +166,7 @@ void KFDBaseComponentTest::TearDown() {
|
||||
|
||||
closelog();
|
||||
|
||||
m_NodeInfo.Delete();
|
||||
ROUTINE_END
|
||||
}
|
||||
|
||||
|
||||
@@ -609,13 +609,19 @@ bool HsaNodeInfo::Init(int NumOfNodes) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
HsaNodeInfo::~HsaNodeInfo() {
|
||||
void HsaNodeInfo::Delete() {
|
||||
const HsaNodeProperties *nodeProperties;
|
||||
|
||||
for (unsigned int i = 0; i < m_HsaNodeProps.size(); i++)
|
||||
delete m_HsaNodeProps.at(i);
|
||||
|
||||
m_HsaNodeProps.clear();
|
||||
m_NodesWithGPU.clear();
|
||||
m_NodesWithoutGPU.clear();
|
||||
}
|
||||
|
||||
HsaNodeInfo::~HsaNodeInfo() {
|
||||
Delete();
|
||||
}
|
||||
|
||||
const std::vector<int>& HsaNodeInfo::GetNodesWithGPU() const {
|
||||
|
||||
@@ -216,6 +216,7 @@ class HsaNodeInfo {
|
||||
~HsaNodeInfo();
|
||||
|
||||
bool Init(int NumOfNodes);
|
||||
void Delete();
|
||||
|
||||
/* This function should be deprecated soon. This for transistion purpose only
|
||||
* Currently, KfdTest is designed to test only ONE node. This function acts
|
||||
|
||||
Reference in New Issue
Block a user