Signed-off-by: xuezhou_yan <yangang20@huawei.com>
This commit is contained in:
xuezhou_yan
2025-08-06 15:03:56 +08:00
parent f147156406
commit 788fcdbf0e
+15 -7
View File
@@ -697,6 +697,20 @@ static int32_t CompareVersion(uint32_t *pcidOsArray, uint32_t *rpcidOsAarry)
return versionFlag;
}
static void FreePointerMemoryEnd(char *pcidContent, char *rpcidContent, char *pcidPriSyscap, char *rpcidPriSyscap, uint32_t type)
{
printf("After the compare cmd is executed, relase the memory.\n");
if (type == TYPE_FILE) {
SafeFree(pcidContent);
SafeFree(rpcidPriSyscap);
SafeFree(rpcidContent);
SafeFree(pcidPriSyscap);
} else if (type == TYPE_STRING) {
SafeFree(rpcidPriSyscap);
SafeFree(pcidPriSyscap);
}
}
int32_t ComparePcidWithRpcidString(char *pcidFile, char *rpcidFile, uint32_t type)
{
int32_t ret;
@@ -750,12 +764,6 @@ int32_t ComparePcidWithRpcidString(char *pcidFile, char *rpcidFile, uint32_t typ
printf("Fail! The pcid does not meet the rpcid\n");
}
if (type == TYPE_FILE) {
FreePointerMemory(pcidContent, rpcidContent, pcidPriSyscap, rpcidPriSyscap);
} else if (type == TYPE_STRING) {
SafeFree(pcidPriSyscap);
SafeFree(rpcidPriSyscap);
}
FreePointerMemoryEnd(pcidContent, rpcidContent, pcidPriSyscap, rpcidPriSyscap, type);
return 0;
}