mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 21:30:10 +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
|
|
@ -18,20 +18,25 @@ OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_create(
|
|||
|
||||
void OpenAPI_cnf_unit_free(OpenAPI_cnf_unit_t *cnf_unit)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == cnf_unit) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(cnf_unit->cnf_unit, node) {
|
||||
OpenAPI_atom_free(node->data);
|
||||
if (cnf_unit->cnf_unit) {
|
||||
OpenAPI_list_for_each(cnf_unit->cnf_unit, node) {
|
||||
OpenAPI_atom_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(cnf_unit->cnf_unit);
|
||||
cnf_unit->cnf_unit = NULL;
|
||||
}
|
||||
OpenAPI_list_free(cnf_unit->cnf_unit);
|
||||
ogs_free(cnf_unit);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_cnf_unit_convertToJSON(OpenAPI_cnf_unit_t *cnf_unit)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (cnf_unit == NULL) {
|
||||
ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [CnfUnit]");
|
||||
|
|
@ -39,22 +44,22 @@ cJSON *OpenAPI_cnf_unit_convertToJSON(OpenAPI_cnf_unit_t *cnf_unit)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!cnf_unit->cnf_unit) {
|
||||
ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *cnf_unitList = cJSON_AddArrayToObject(item, "cnfUnit");
|
||||
if (cnf_unitList == NULL) {
|
||||
ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *cnf_unit_node;
|
||||
if (cnf_unit->cnf_unit) {
|
||||
OpenAPI_list_for_each(cnf_unit->cnf_unit, cnf_unit_node) {
|
||||
cJSON *itemLocal = OpenAPI_atom_convertToJSON(cnf_unit_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(cnf_unitList, itemLocal);
|
||||
OpenAPI_list_for_each(cnf_unit->cnf_unit, node) {
|
||||
cJSON *itemLocal = OpenAPI_atom_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_cnf_unit_convertToJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(cnf_unitList, itemLocal);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -64,43 +69,49 @@ end:
|
|||
OpenAPI_cnf_unit_t *OpenAPI_cnf_unit_parseFromJSON(cJSON *cnf_unitJSON)
|
||||
{
|
||||
OpenAPI_cnf_unit_t *cnf_unit_local_var = NULL;
|
||||
cJSON *cnf_unit = cJSON_GetObjectItemCaseSensitive(cnf_unitJSON, "cnfUnit");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *cnf_unit = NULL;
|
||||
OpenAPI_list_t *cnf_unitList = NULL;
|
||||
cnf_unit = cJSON_GetObjectItemCaseSensitive(cnf_unitJSON, "cnfUnit");
|
||||
if (!cnf_unit) {
|
||||
ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *cnf_unitList;
|
||||
cJSON *cnf_unit_local_nonprimitive;
|
||||
if (!cJSON_IsArray(cnf_unit)){
|
||||
ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cnf_unitList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(cnf_unit_local_nonprimitive, cnf_unit ) {
|
||||
if (!cJSON_IsObject(cnf_unit_local_nonprimitive)) {
|
||||
cJSON *cnf_unit_local = NULL;
|
||||
if (!cJSON_IsArray(cnf_unit)) {
|
||||
ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_atom_t *cnf_unitItem = OpenAPI_atom_parseFromJSON(cnf_unit_local_nonprimitive);
|
||||
|
||||
if (!cnf_unitItem) {
|
||||
ogs_error("No cnf_unitItem");
|
||||
OpenAPI_list_free(cnf_unitList);
|
||||
goto end;
|
||||
cnf_unitList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(cnf_unit_local, cnf_unit) {
|
||||
if (!cJSON_IsObject(cnf_unit_local)) {
|
||||
ogs_error("OpenAPI_cnf_unit_parseFromJSON() failed [cnf_unit]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_atom_t *cnf_unitItem = OpenAPI_atom_parseFromJSON(cnf_unit_local);
|
||||
if (!cnf_unitItem) {
|
||||
ogs_error("No cnf_unitItem");
|
||||
OpenAPI_list_free(cnf_unitList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(cnf_unitList, cnf_unitItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(cnf_unitList, cnf_unitItem);
|
||||
}
|
||||
|
||||
cnf_unit_local_var = OpenAPI_cnf_unit_create (
|
||||
cnf_unitList
|
||||
);
|
||||
|
||||
return cnf_unit_local_var;
|
||||
end:
|
||||
if (cnf_unitList) {
|
||||
OpenAPI_list_for_each(cnf_unitList, node) {
|
||||
OpenAPI_atom_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(cnf_unitList);
|
||||
cnf_unitList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue