mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -20,20 +20,25 @@ OpenAPI_flow_info_t *OpenAPI_flow_info_create(
|
|||
|
||||
void OpenAPI_flow_info_free(OpenAPI_flow_info_t *flow_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == flow_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(flow_info->flow_descriptions, node) {
|
||||
ogs_free(node->data);
|
||||
if (flow_info->flow_descriptions) {
|
||||
OpenAPI_list_for_each(flow_info->flow_descriptions, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(flow_info->flow_descriptions);
|
||||
flow_info->flow_descriptions = NULL;
|
||||
}
|
||||
OpenAPI_list_free(flow_info->flow_descriptions);
|
||||
ogs_free(flow_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_flow_info_convertToJSON(OpenAPI_flow_info_t *flow_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (flow_info == NULL) {
|
||||
ogs_error("OpenAPI_flow_info_convertToJSON() failed [FlowInfo]");
|
||||
|
|
@ -47,19 +52,17 @@ cJSON *OpenAPI_flow_info_convertToJSON(OpenAPI_flow_info_t *flow_info)
|
|||
}
|
||||
|
||||
if (flow_info->flow_descriptions) {
|
||||
cJSON *flow_descriptions = cJSON_AddArrayToObject(item, "flowDescriptions");
|
||||
if (flow_descriptions == NULL) {
|
||||
cJSON *flow_descriptionsList = cJSON_AddArrayToObject(item, "flowDescriptions");
|
||||
if (flow_descriptionsList == NULL) {
|
||||
ogs_error("OpenAPI_flow_info_convertToJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *flow_descriptions_node;
|
||||
OpenAPI_list_for_each(flow_info->flow_descriptions, flow_descriptions_node) {
|
||||
if (cJSON_AddStringToObject(flow_descriptions, "", (char*)flow_descriptions_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_flow_info_convertToJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(flow_info->flow_descriptions, node) {
|
||||
if (cJSON_AddStringToObject(flow_descriptionsList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_flow_info_convertToJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -69,35 +72,39 @@ end:
|
|||
OpenAPI_flow_info_t *OpenAPI_flow_info_parseFromJSON(cJSON *flow_infoJSON)
|
||||
{
|
||||
OpenAPI_flow_info_t *flow_info_local_var = NULL;
|
||||
cJSON *flow_id = cJSON_GetObjectItemCaseSensitive(flow_infoJSON, "flowId");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *flow_id = NULL;
|
||||
cJSON *flow_descriptions = NULL;
|
||||
OpenAPI_list_t *flow_descriptionsList = NULL;
|
||||
flow_id = cJSON_GetObjectItemCaseSensitive(flow_infoJSON, "flowId");
|
||||
if (!flow_id) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsNumber(flow_id)) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *flow_descriptions = cJSON_GetObjectItemCaseSensitive(flow_infoJSON, "flowDescriptions");
|
||||
|
||||
OpenAPI_list_t *flow_descriptionsList;
|
||||
flow_descriptions = cJSON_GetObjectItemCaseSensitive(flow_infoJSON, "flowDescriptions");
|
||||
if (flow_descriptions) {
|
||||
cJSON *flow_descriptions_local;
|
||||
if (!cJSON_IsArray(flow_descriptions)) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
flow_descriptionsList = OpenAPI_list_create();
|
||||
cJSON *flow_descriptions_local = NULL;
|
||||
if (!cJSON_IsArray(flow_descriptions)) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(flow_descriptions_local, flow_descriptions) {
|
||||
if (!cJSON_IsString(flow_descriptions_local)) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(flow_descriptionsList, ogs_strdup(flow_descriptions_local->valuestring));
|
||||
}
|
||||
flow_descriptionsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(flow_descriptions_local, flow_descriptions) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(flow_descriptions_local)) {
|
||||
ogs_error("OpenAPI_flow_info_parseFromJSON() failed [flow_descriptions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(flow_descriptionsList, ogs_strdup(flow_descriptions_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
flow_info_local_var = OpenAPI_flow_info_create (
|
||||
|
|
@ -108,6 +115,13 @@ OpenAPI_flow_info_t *OpenAPI_flow_info_parseFromJSON(cJSON *flow_infoJSON)
|
|||
|
||||
return flow_info_local_var;
|
||||
end:
|
||||
if (flow_descriptionsList) {
|
||||
OpenAPI_list_for_each(flow_descriptionsList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(flow_descriptionsList);
|
||||
flow_descriptionsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue