mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 02:11:19 -04:00
[Bug] Fix memory leak risk in syscap_tool
IssueNo: https://gitee.com/openharmony/developtools_syscap_codec/issues/IAGOX4 Signed-off-by: luming <luming29@huawei.com>
This commit is contained in:
+6
-1
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user