!472 [Bug]: 内存泄漏风险清理:syscap_tool.c

Merge pull request !472 from Luming/master
This commit is contained in:
openharmony_ci
2024-08-01 13:23:31 +00:00
committed by Gitee
2 changed files with 10 additions and 1 deletions
+6 -1
View File
@@ -112,7 +112,12 @@ int32_t SetPriSyscap(PCIDMain *pcidBuffer, cJSON *jsonPriSyscapObj,
PRINT_ERR("get jsonArrayItem failed!");
return -1;
}
priSyscapStr = strchr(jsonArrayItem->valuestring, '.') + 1;
priSyscapStr = strchr(jsonArrayItem->valuestring, '.');
if (priSyscapStr == NULL) {
PRINT_ERR("get priSyscapStr failed!");
return -1;
}
priSyscapStr += 1;
errno_t nRet = strcat_s(priSyscapHead, allPriSyscapStrLen + 1, priSyscapStr);
nRet += strcat_s(priSyscapHead, allPriSyscapStrLen + 1, ",");
if (nRet != EOK) {
+4
View File
@@ -78,6 +78,10 @@ int main(int argc, char **argv)
g_customerfileinfo.pcidfile = NULL;
g_customerfileinfo.rpcidfile = NULL;
char *outputpath = getcwd(curpath, sizeof(curpath));
if (outputpath == NULL) {
PRINT_ERR("Get outputpath failed.\n");
return -1;
}
while (1) {
int32_t flag = getopt_long(argc, argv, "hvRPC:edsi:o:", g_longOptions, &optIndex);