From 9f70f18a6d443dcccb39f5440e114fa704491c4b Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Sat, 25 May 2024 18:04:12 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=97=A0=E7=AC=A6=E5=8F=B7=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E9=BB=98=E8=AE=A4=E4=BB=8E0=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=EF=BC=8C=E4=B8=8D=E4=BC=9A=E5=B0=8F=E4=BA=8E0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/create_pcid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/create_pcid.c b/src/create_pcid.c index 6f9a373..f2ac891 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -362,7 +362,7 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL return -1; } - if (contextBufLen < 0 || contextBufLen > UINT32_MAX) { + if (contextBufLen > UINT32_MAX) { PRINT_ERR("the data privateSyscapLen is out of scope."); return GetPriSyscapResult(capVectorPtr, -1); } -- Gitee From fae0be817c5a7b71d565a5fee757d44b482b78c8 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 09:56:31 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0feature=EF=BC=9Asyscap?= =?UTF-8?q?=5Fcodec=5Fconfig=5Fextern=5Fpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- bundle.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index 6d5657c..caa571e 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,10 @@ "name": "syscap_codec", "subsystem": "developtools", "syscap": [ "SystemCapability.Developtools.Syscap" ], - "feature": [ "syscap_codec_config_path" ], + "feature": [ + "syscap_codec_config_path", + "syscap_codec_config_extern_path" + ], "adapted_system_type": [ "small", "standard" ], "rom": "0", "ram": "0", -- Gitee From 8d089648ae1e7859de3617a4b3c7da1af5e42d25 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 10:20:24 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=8F=90=E5=8F=96=E8=B6=85=E5=A4=A7?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- napi/napi_query_syscap.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/napi/napi_query_syscap.cpp b/napi/napi_query_syscap.cpp index 6f75b2b..c5bad76 100644 --- a/napi/napi_query_syscap.cpp +++ b/napi/napi_query_syscap.cpp @@ -112,7 +112,7 @@ static char* GetSystemCapability() bool retBool; int retError, priOutputLen, priCapArrayCnt; char osOutput[SINGLE_SYSCAP_LEN] = {}; - + uint32_t *osCapU32 = nullptr; char *priOutput = nullptr; @@ -149,14 +149,13 @@ FREE_PRIOUTPUT: return allSyscapBuffer; } -napi_value QuerySystemCapability(napi_env env, napi_callback_info info) +napi_value PreHandleSystemCapability( + napi_env env, napi_callback_info info, SystemCapabilityAsyncContext *asyncContext) { GET_PARAMS(env, info, 1); NAPI_ASSERT(env, argc <= 1, "too many parameters"); napi_value result = nullptr; - SystemCapabilityAsyncContext* asyncContext = new SystemCapabilityAsyncContext(); - asyncContext->env = env; napi_valuetype valueType = napi_undefined; @@ -172,6 +171,13 @@ napi_value QuerySystemCapability(napi_env env, napi_callback_info info) } else { napi_get_undefined(env, &result); } + return result; +} + +napi_value QuerySystemCapability(napi_env env, napi_callback_info info) +{ + SystemCapabilityAsyncContext *asyncContext = new SystemCapabilityAsyncContext(); + napi_value result = PreHandleSystemCapability(env, info, asyncContext); napi_value resource = nullptr; napi_create_string_utf8(env, "napi_value QuerySystemCapability", NAPI_AUTO_LENGTH, &resource); -- Gitee From 8b63b54a9b3d4f1e1bf50b501b68e4dbff197c68 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 11:25:48 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9RPCIDEncode=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=B8=ADcjsonObjectRoot=E5=8F=98=E9=87=8F=E6=9C=AA?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98=E7=9A=84=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/syscap_tool.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index e7b1314..ecd5a90 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -121,11 +121,13 @@ static int32_t FillOsCapLength(char *convertedBuffer, char *contextBuffer, struc return ret; } -static int32_t FreeAfterRPCIDEncode(char *convertedBuffer, char *contextBuffer, int32_t type, int32_t ret) +static int32_t FreeAfterRPCIDEncode( + cJSON *cjsonObjectRoot, char *convertedBuffer, char *contextBuffer, int32_t type, int32_t ret) { if (type == FREE_CONVERT_OUT_RPCID_ENCODE) { free(convertedBuffer); } + cJSON_Delete(cjsonObjectRoot); FreeContextBuffer(contextBuffer); return ret; } @@ -150,19 +152,19 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) gJsonObjectSysCap.cjsonObjectRoot = cJSON_ParseWithLength(contextBuffer, bufferLen); if (gJsonObjectSysCap.cjsonObjectRoot == NULL) { PRINT_ERR("cJSON_Parse failed, context buffer is:\n%s\n", contextBuffer); - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } gJsonObjectSysCap.sysCapPtr = cJSON_GetObjectItem(gJsonObjectSysCap.cjsonObjectRoot, "syscap"); if (gJsonObjectSysCap.sysCapPtr == NULL || !cJSON_IsArray(gJsonObjectSysCap.sysCapPtr)) { PRINT_ERR("get \"syscap\" object failed.\n"); - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); if (ret < 0) { PRINT_ERR("get \"syscap\" array size failed\n"); - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } sysCapSize = (uint32_t)ret; // 2, to save SysCaptype & SysCapLength @@ -171,19 +173,19 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) convertedBuffer = (char *)malloc(convertedBufLen); if (convertedBuffer == NULL) { PRINT_ERR("malloc failed\n"); - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } (void)memset_s(convertedBuffer, convertedBufLen, 0, convertedBufLen); ret = FillOsCapLength(convertedBuffer, contextBuffer, gJsonObjectSysCap, sysCapSize, ret); if (ret == -1) { - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } - return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } static int32_t ParseRpcidToJson(char *input, uint32_t inputLen, cJSON *rpcidJson) -- Gitee From 941a09f3c3db6b06dbaa1a7b76ca58918f724d13 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 11:28:44 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9DecodePrivateSyscap?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=B0=86outputArray=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E7=BD=AE=E4=B8=BAnull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- interfaces/inner_api/syscap_interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 34cb6f0..c70d560 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -249,6 +249,7 @@ bool DecodePrivateSyscap(char *input, char (**output)[SINGLE_SYSCAP_LEN], int *o *bufferPos = '\0'; if (sprintf_s(*outputArray, SINGLE_SYSCAP_LEN, "SystemCapability.%s", buffer) == -1) { free(outputArray); + outputArray = NULL; return false; } bufferPos = buffer; -- Gitee From 9b4318fcf07aefcbb9b481cf5429ce3fcb565e5a Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 16:48:24 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- napi/napi_query_syscap.cpp | 2 +- src/syscap_tool.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/napi/napi_query_syscap.cpp b/napi/napi_query_syscap.cpp index c5bad76..f089b36 100644 --- a/napi/napi_query_syscap.cpp +++ b/napi/napi_query_syscap.cpp @@ -150,7 +150,7 @@ FREE_PRIOUTPUT: } napi_value PreHandleSystemCapability( - napi_env env, napi_callback_info info, SystemCapabilityAsyncContext *asyncContext) + napi_env env, napi_callback_info info, SystemCapabilityAsyncContext *asyncContext) { GET_PARAMS(env, info, 1); NAPI_ASSERT(env, argc <= 1, "too many parameters"); diff --git a/src/syscap_tool.c b/src/syscap_tool.c index ecd5a90..9cd7297 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -122,7 +122,7 @@ static int32_t FillOsCapLength(char *convertedBuffer, char *contextBuffer, struc } static int32_t FreeAfterRPCIDEncode( - cJSON *cjsonObjectRoot, char *convertedBuffer, char *contextBuffer, int32_t type, int32_t ret) + cJSON *cjsonObjectRoot, char *convertedBuffer, char *contextBuffer, int32_t type, int32_t ret) { if (type == FREE_CONVERT_OUT_RPCID_ENCODE) { free(convertedBuffer); @@ -173,7 +173,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) convertedBuffer = (char *)malloc(convertedBufLen); if (convertedBuffer == NULL) { PRINT_ERR("malloc failed\n"); - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, + convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } (void)memset_s(convertedBuffer, convertedBufLen, 0, convertedBufLen); @@ -185,7 +186,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, + convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } static int32_t ParseRpcidToJson(char *input, uint32_t inputLen, cJSON *rpcidJson) -- Gitee From ec20278d87d6b4f87c64a3dff02d1440615e6d5b Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 20:39:17 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84cJSON=5FDelete(capVectorPtr?= =?UTF-8?q?)=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=94=A8=E4=BE=8B=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/create_pcid.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/create_pcid.c b/src/create_pcid.c index f2ac891..9d433fc 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -344,7 +344,6 @@ int32_t GetOsSyscap(PCIDMain *pcidMain, cJSON *sysCapObject) return -1; } - cJSON_Delete(capVectorPtr); return 0; } -- Gitee From 59ca6c58d9b05a7595febf0eb82065d4ce842f25 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 20:40:52 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/syscap_tool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index 9cd7297..d096464 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -164,7 +164,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); if (ret < 0) { PRINT_ERR("get \"syscap\" array size failed\n"); - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, + convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } sysCapSize = (uint32_t)ret; // 2, to save SysCaptype & SysCapLength @@ -180,7 +181,8 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) ret = FillOsCapLength(convertedBuffer, contextBuffer, gJsonObjectSysCap, sysCapSize, ret); if (ret == -1) { - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, + convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); if (ret != 0) { -- Gitee From 4c0e5e95d254335ecd75da92414ea433545acd80 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Mon, 27 May 2024 21:08:41 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E8=A7=84=E8=8C=832=E8=A1=8C=E6=94=B9?= =?UTF-8?q?=E6=88=901=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/syscap_tool.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index d096464..bcd09fd 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -164,8 +164,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) ret = cJSON_GetArraySize(gJsonObjectSysCap.sysCapPtr); if (ret < 0) { PRINT_ERR("get \"syscap\" array size failed\n"); - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, - convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } sysCapSize = (uint32_t)ret; // 2, to save SysCaptype & SysCapLength @@ -174,22 +173,19 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) convertedBuffer = (char *)malloc(convertedBufLen); if (convertedBuffer == NULL) { PRINT_ERR("malloc failed\n"); - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, - convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer, FREE_CONTEXT_OUT_RPCID_ENCODE, -1); } (void)memset_s(convertedBuffer, convertedBufLen, 0, convertedBufLen); ret = FillOsCapLength(convertedBuffer, contextBuffer, gJsonObjectSysCap, sysCapSize, ret); if (ret == -1) { - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, - convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer,FREE_CONVERT_OUT_RPCID_ENCODE, ret); } ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } - return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, - convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); + return FreeAfterRPCIDEncode(gJsonObjectSysCap.cjsonObjectRoot, convertedBuffer, contextBuffer,FREE_CONVERT_OUT_RPCID_ENCODE, ret); } static int32_t ParseRpcidToJson(char *input, uint32_t inputLen, cJSON *rpcidJson) -- Gitee From dc9befa45fd00068169f50ec3f54ae910386a583 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Tue, 28 May 2024 15:07:20 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E5=BD=93freePcidInfo.priSyscapFull=20=3D?= =?UTF-8?q?=3D=20NULL=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=BA=94=E5=86=8D?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E8=AF=A5free=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/create_pcid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/create_pcid.c b/src/create_pcid.c index 9d433fc..5316984 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -897,7 +897,7 @@ int32_t EncodePcidscToString(char *inputFile, char *outDirPath) freePcidInfo.priSyscapFull = (char *)malloc(priSyscapCount * SINGLE_SYSCAP_LEN); if (freePcidInfo.priSyscapFull == NULL) { PRINT_ERR("malloc failed\n"); - return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_PRISYSCAP_FULL_OUT, ret); + return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_CONTEXT_OUT, ret); } (void)memset_s(freePcidInfo.priSyscapFull, priSyscapCount * SINGLE_SYSCAP_LEN, 0, priSyscapCount * SINGLE_SYSCAP_LEN); -- Gitee From cc327d89dfdea66bf4107be0cb1f38048ef11015 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Tue, 28 May 2024 15:07:49 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E9=87=8A=E6=94=BEpriSyscapArray=E6=95=B0?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- interfaces/inner_api/syscap_interface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index c70d560..c935297 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -516,7 +516,10 @@ char *DecodeRpcidToStringFormat(const char *inputFile) } PartSysCapAndOutBuffer(freeAfterDecodeRpcidInfo, outBuffer, priSyscapArray, sysCapArray); + + free(priSyscapArray); priSyscapArray = NULL; + return FreeAfterDecodeRpcidToString(freeAfterDecodeRpcidInfo, FREE_MALLOC_PRISYSCAP_AFTER_DECODE_RPCID, outBuffer); } -- Gitee