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,21 +20,29 @@ OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_create(
|
|||
|
||||
void OpenAPI_pc5_qo_s_para_free(OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == pc5_qo_s_para) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(pc5_qo_s_para->pc5_qos_flow_list, node) {
|
||||
OpenAPI_pc5_qos_flow_item_free(node->data);
|
||||
if (pc5_qo_s_para->pc5_qos_flow_list) {
|
||||
OpenAPI_list_for_each(pc5_qo_s_para->pc5_qos_flow_list, node) {
|
||||
OpenAPI_pc5_qos_flow_item_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pc5_qo_s_para->pc5_qos_flow_list);
|
||||
pc5_qo_s_para->pc5_qos_flow_list = NULL;
|
||||
}
|
||||
if (pc5_qo_s_para->pc5_link_ambr) {
|
||||
ogs_free(pc5_qo_s_para->pc5_link_ambr);
|
||||
pc5_qo_s_para->pc5_link_ambr = NULL;
|
||||
}
|
||||
OpenAPI_list_free(pc5_qo_s_para->pc5_qos_flow_list);
|
||||
ogs_free(pc5_qo_s_para->pc5_link_ambr);
|
||||
ogs_free(pc5_qo_s_para);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_pc5_qo_s_para_convertToJSON(OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (pc5_qo_s_para == NULL) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed [Pc5QoSPara]");
|
||||
|
|
@ -42,22 +50,22 @@ cJSON *OpenAPI_pc5_qo_s_para_convertToJSON(OpenAPI_pc5_qo_s_para_t *pc5_qo_s_par
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!pc5_qo_s_para->pc5_qos_flow_list) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed [pc5_qos_flow_list]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *pc5_qos_flow_listList = cJSON_AddArrayToObject(item, "pc5QosFlowList");
|
||||
if (pc5_qos_flow_listList == NULL) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *pc5_qos_flow_list_node;
|
||||
if (pc5_qo_s_para->pc5_qos_flow_list) {
|
||||
OpenAPI_list_for_each(pc5_qo_s_para->pc5_qos_flow_list, pc5_qos_flow_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_pc5_qos_flow_item_convertToJSON(pc5_qos_flow_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(pc5_qos_flow_listList, itemLocal);
|
||||
OpenAPI_list_for_each(pc5_qo_s_para->pc5_qos_flow_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_pc5_qos_flow_item_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_convertToJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(pc5_qos_flow_listList, itemLocal);
|
||||
}
|
||||
|
||||
if (pc5_qo_s_para->pc5_link_ambr) {
|
||||
|
|
@ -74,41 +82,40 @@ end:
|
|||
OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_parseFromJSON(cJSON *pc5_qo_s_paraJSON)
|
||||
{
|
||||
OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para_local_var = NULL;
|
||||
cJSON *pc5_qos_flow_list = cJSON_GetObjectItemCaseSensitive(pc5_qo_s_paraJSON, "pc5QosFlowList");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *pc5_qos_flow_list = NULL;
|
||||
OpenAPI_list_t *pc5_qos_flow_listList = NULL;
|
||||
cJSON *pc5_link_ambr = NULL;
|
||||
pc5_qos_flow_list = cJSON_GetObjectItemCaseSensitive(pc5_qo_s_paraJSON, "pc5QosFlowList");
|
||||
if (!pc5_qos_flow_list) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *pc5_qos_flow_listList;
|
||||
cJSON *pc5_qos_flow_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(pc5_qos_flow_list)){
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
pc5_qos_flow_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(pc5_qos_flow_list_local_nonprimitive, pc5_qos_flow_list ) {
|
||||
if (!cJSON_IsObject(pc5_qos_flow_list_local_nonprimitive)) {
|
||||
cJSON *pc5_qos_flow_list_local = NULL;
|
||||
if (!cJSON_IsArray(pc5_qos_flow_list)) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_pc5_qos_flow_item_t *pc5_qos_flow_listItem = OpenAPI_pc5_qos_flow_item_parseFromJSON(pc5_qos_flow_list_local_nonprimitive);
|
||||
|
||||
if (!pc5_qos_flow_listItem) {
|
||||
ogs_error("No pc5_qos_flow_listItem");
|
||||
OpenAPI_list_free(pc5_qos_flow_listList);
|
||||
goto end;
|
||||
pc5_qos_flow_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(pc5_qos_flow_list_local, pc5_qos_flow_list) {
|
||||
if (!cJSON_IsObject(pc5_qos_flow_list_local)) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON() failed [pc5_qos_flow_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_pc5_qos_flow_item_t *pc5_qos_flow_listItem = OpenAPI_pc5_qos_flow_item_parseFromJSON(pc5_qos_flow_list_local);
|
||||
if (!pc5_qos_flow_listItem) {
|
||||
ogs_error("No pc5_qos_flow_listItem");
|
||||
OpenAPI_list_free(pc5_qos_flow_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(pc5_qos_flow_listList, pc5_qos_flow_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(pc5_qos_flow_listList, pc5_qos_flow_listItem);
|
||||
}
|
||||
|
||||
cJSON *pc5_link_ambr = cJSON_GetObjectItemCaseSensitive(pc5_qo_s_paraJSON, "pc5LinkAmbr");
|
||||
|
||||
pc5_link_ambr = cJSON_GetObjectItemCaseSensitive(pc5_qo_s_paraJSON, "pc5LinkAmbr");
|
||||
if (pc5_link_ambr) {
|
||||
if (!cJSON_IsString(pc5_link_ambr)) {
|
||||
if (!cJSON_IsString(pc5_link_ambr) && !cJSON_IsNull(pc5_link_ambr)) {
|
||||
ogs_error("OpenAPI_pc5_qo_s_para_parseFromJSON() failed [pc5_link_ambr]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -116,11 +123,18 @@ OpenAPI_pc5_qo_s_para_t *OpenAPI_pc5_qo_s_para_parseFromJSON(cJSON *pc5_qo_s_par
|
|||
|
||||
pc5_qo_s_para_local_var = OpenAPI_pc5_qo_s_para_create (
|
||||
pc5_qos_flow_listList,
|
||||
pc5_link_ambr ? ogs_strdup(pc5_link_ambr->valuestring) : NULL
|
||||
pc5_link_ambr && !cJSON_IsNull(pc5_link_ambr) ? ogs_strdup(pc5_link_ambr->valuestring) : NULL
|
||||
);
|
||||
|
||||
return pc5_qo_s_para_local_var;
|
||||
end:
|
||||
if (pc5_qos_flow_listList) {
|
||||
OpenAPI_list_for_each(pc5_qos_flow_listList, node) {
|
||||
OpenAPI_pc5_qos_flow_item_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(pc5_qos_flow_listList);
|
||||
pc5_qos_flow_listList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue