From 788fcdbf0e593c3c9de2d9ab43030d84a398f2d3 Mon Sep 17 00:00:00 2001 From: xuezhou_yan Date: Wed, 6 Aug 2025 15:03:56 +0800 Subject: [PATCH] =?UTF-8?q?[Bug]:=20=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=B8=85=E7=90=86=E6=B2=A1=E6=9C=89=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AD=98=20https://gitee.com/openharmony/dev?= =?UTF-8?q?eloptools=5Fsyscap=5Fcodec/issues/ICRCLU?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuezhou_yan --- src/syscap_tool.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index fedff4d..4ab4a6a 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -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; }