mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 16:20:00 +00:00
Description:repair mem leak
Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: cat <chenjinxiang3@huawei.com>
This commit is contained in:
parent
e0a3a4b0d9
commit
e879f80539
@ -1100,7 +1100,7 @@ void ParseAllServices(const cJSON *fileRoot, const ConfigContext *context)
|
||||
}
|
||||
int ret = ParseOneService(curItem, service);
|
||||
if (ret != SERVICE_SUCCESS) {
|
||||
INIT_LOGE("Service error %s parse config error.", service->name, cJSON_Print(curItem));
|
||||
INIT_LOGE("Service error %s parse config error.", service->name);
|
||||
service->lastErrno = INIT_ECFG;
|
||||
continue;
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ static int ParseDeviceConfig(char *p)
|
||||
return -1;
|
||||
}
|
||||
config->name = strdup(items[0]); // device node
|
||||
INIT_ERROR_CHECK(config->name != NULL, FreeStringVector(items, count); return -1, "failed dup config name");
|
||||
INIT_ERROR_CHECK(config->name != NULL, FreeStringVector(items, count);
|
||||
free(config); return -1, "failed dup config name");
|
||||
errno = 0;
|
||||
config->mode = strtoul(items[1], NULL, OCTAL_BASE); // mode
|
||||
INIT_ERROR_CHECK(errno == 0, config->mode = DEVMODE,
|
||||
@ -93,7 +94,8 @@ static int ParseDeviceConfig(char *p)
|
||||
config->gid = (gid_t)DecodeGid(items[3]); // gid
|
||||
if (count == expectedCount) {
|
||||
config->parameter = strdup(items[4]); // device parameter
|
||||
INIT_ERROR_CHECK(config->parameter != NULL, FreeStringVector(items, count); return -1, "failed dup parameter");
|
||||
INIT_ERROR_CHECK(config->parameter != NULL, FreeStringVector(items, count);
|
||||
free((void*)config->name); free(config); return -1, "failed dup parameter");
|
||||
} else {
|
||||
config->parameter = NULL;
|
||||
}
|
||||
@ -125,9 +127,11 @@ static int ParseSysfsConfig(char *p)
|
||||
return -1;
|
||||
}
|
||||
config->sysPath = strdup(items[0]); // sys path
|
||||
INIT_ERROR_CHECK(config->sysPath != NULL, FreeStringVector(items, count); return -1, "failed to dup syspath");
|
||||
INIT_ERROR_CHECK(config->sysPath != NULL, FreeStringVector(items, count);
|
||||
free(config); return -1, "failed to dup syspath");
|
||||
config->attr = strdup(items[1]); // attribute
|
||||
INIT_ERROR_CHECK(config->attr != NULL, FreeStringVector(items, count); return -1, "failed to dup attr");
|
||||
INIT_ERROR_CHECK(config->attr != NULL, FreeStringVector(items, count);
|
||||
free((void*)config->sysPath); free(config); return -1, "failed to dup attr");
|
||||
errno = 0;
|
||||
config->mode = strtoul(items[2], NULL, OCTAL_BASE); // mode
|
||||
INIT_ERROR_CHECK(errno == 0, config->mode = DEVMODE,
|
||||
|
Loading…
Reference in New Issue
Block a user