mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 05:40: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
|
|
@ -22,21 +22,29 @@ OpenAPI_resources_allocation_info_t *OpenAPI_resources_allocation_info_create(
|
|||
|
||||
void OpenAPI_resources_allocation_info_free(OpenAPI_resources_allocation_info_t *resources_allocation_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == resources_allocation_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(resources_allocation_info->flows, node) {
|
||||
OpenAPI_flows_free(node->data);
|
||||
if (resources_allocation_info->flows) {
|
||||
OpenAPI_list_for_each(resources_allocation_info->flows, node) {
|
||||
OpenAPI_flows_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(resources_allocation_info->flows);
|
||||
resources_allocation_info->flows = NULL;
|
||||
}
|
||||
if (resources_allocation_info->alt_ser_req) {
|
||||
ogs_free(resources_allocation_info->alt_ser_req);
|
||||
resources_allocation_info->alt_ser_req = NULL;
|
||||
}
|
||||
OpenAPI_list_free(resources_allocation_info->flows);
|
||||
ogs_free(resources_allocation_info->alt_ser_req);
|
||||
ogs_free(resources_allocation_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_resources_allocation_info_convertToJSON(OpenAPI_resources_allocation_info_t *resources_allocation_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (resources_allocation_info == NULL) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_convertToJSON() failed [ResourcesAllocationInfo]");
|
||||
|
|
@ -44,7 +52,7 @@ cJSON *OpenAPI_resources_allocation_info_convertToJSON(OpenAPI_resources_allocat
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (resources_allocation_info->mc_resourc_status) {
|
||||
if (resources_allocation_info->mc_resourc_status != OpenAPI_media_component_resources_status_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "mcResourcStatus", OpenAPI_media_component_resources_status_ToString(resources_allocation_info->mc_resourc_status)) == NULL) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_convertToJSON() failed [mc_resourc_status]");
|
||||
goto end;
|
||||
|
|
@ -57,17 +65,13 @@ cJSON *OpenAPI_resources_allocation_info_convertToJSON(OpenAPI_resources_allocat
|
|||
ogs_error("OpenAPI_resources_allocation_info_convertToJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *flows_node;
|
||||
if (resources_allocation_info->flows) {
|
||||
OpenAPI_list_for_each(resources_allocation_info->flows, flows_node) {
|
||||
cJSON *itemLocal = OpenAPI_flows_convertToJSON(flows_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_convertToJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(flowsList, itemLocal);
|
||||
OpenAPI_list_for_each(resources_allocation_info->flows, node) {
|
||||
cJSON *itemLocal = OpenAPI_flows_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_convertToJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(flowsList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,9 +89,13 @@ end:
|
|||
OpenAPI_resources_allocation_info_t *OpenAPI_resources_allocation_info_parseFromJSON(cJSON *resources_allocation_infoJSON)
|
||||
{
|
||||
OpenAPI_resources_allocation_info_t *resources_allocation_info_local_var = NULL;
|
||||
cJSON *mc_resourc_status = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "mcResourcStatus");
|
||||
|
||||
OpenAPI_media_component_resources_status_e mc_resourc_statusVariable;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *mc_resourc_status = NULL;
|
||||
OpenAPI_media_component_resources_status_e mc_resourc_statusVariable = 0;
|
||||
cJSON *flows = NULL;
|
||||
OpenAPI_list_t *flowsList = NULL;
|
||||
cJSON *alt_ser_req = NULL;
|
||||
mc_resourc_status = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "mcResourcStatus");
|
||||
if (mc_resourc_status) {
|
||||
if (!cJSON_IsString(mc_resourc_status)) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_parseFromJSON() failed [mc_resourc_status]");
|
||||
|
|
@ -96,39 +104,34 @@ OpenAPI_resources_allocation_info_t *OpenAPI_resources_allocation_info_parseFrom
|
|||
mc_resourc_statusVariable = OpenAPI_media_component_resources_status_FromString(mc_resourc_status->valuestring);
|
||||
}
|
||||
|
||||
cJSON *flows = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "flows");
|
||||
|
||||
OpenAPI_list_t *flowsList;
|
||||
flows = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "flows");
|
||||
if (flows) {
|
||||
cJSON *flows_local_nonprimitive;
|
||||
if (!cJSON_IsArray(flows)){
|
||||
ogs_error("OpenAPI_resources_allocation_info_parseFromJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
flowsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(flows_local_nonprimitive, flows ) {
|
||||
if (!cJSON_IsObject(flows_local_nonprimitive)) {
|
||||
cJSON *flows_local = NULL;
|
||||
if (!cJSON_IsArray(flows)) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_parseFromJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_flows_t *flowsItem = OpenAPI_flows_parseFromJSON(flows_local_nonprimitive);
|
||||
|
||||
if (!flowsItem) {
|
||||
ogs_error("No flowsItem");
|
||||
OpenAPI_list_free(flowsList);
|
||||
goto end;
|
||||
flowsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(flows_local, flows) {
|
||||
if (!cJSON_IsObject(flows_local)) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_parseFromJSON() failed [flows]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_flows_t *flowsItem = OpenAPI_flows_parseFromJSON(flows_local);
|
||||
if (!flowsItem) {
|
||||
ogs_error("No flowsItem");
|
||||
OpenAPI_list_free(flowsList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(flowsList, flowsItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(flowsList, flowsItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *alt_ser_req = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "altSerReq");
|
||||
|
||||
alt_ser_req = cJSON_GetObjectItemCaseSensitive(resources_allocation_infoJSON, "altSerReq");
|
||||
if (alt_ser_req) {
|
||||
if (!cJSON_IsString(alt_ser_req)) {
|
||||
if (!cJSON_IsString(alt_ser_req) && !cJSON_IsNull(alt_ser_req)) {
|
||||
ogs_error("OpenAPI_resources_allocation_info_parseFromJSON() failed [alt_ser_req]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -137,11 +140,18 @@ OpenAPI_resources_allocation_info_t *OpenAPI_resources_allocation_info_parseFrom
|
|||
resources_allocation_info_local_var = OpenAPI_resources_allocation_info_create (
|
||||
mc_resourc_status ? mc_resourc_statusVariable : 0,
|
||||
flows ? flowsList : NULL,
|
||||
alt_ser_req ? ogs_strdup(alt_ser_req->valuestring) : NULL
|
||||
alt_ser_req && !cJSON_IsNull(alt_ser_req) ? ogs_strdup(alt_ser_req->valuestring) : NULL
|
||||
);
|
||||
|
||||
return resources_allocation_info_local_var;
|
||||
end:
|
||||
if (flowsList) {
|
||||
OpenAPI_list_for_each(flowsList, node) {
|
||||
OpenAPI_flows_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(flowsList);
|
||||
flowsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue