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
|
|
@ -22,25 +22,36 @@ OpenAPI_location_area_t *OpenAPI_location_area_create(
|
|||
|
||||
void OpenAPI_location_area_free(OpenAPI_location_area_t *location_area)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == location_area) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(location_area->geographic_areas, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
if (location_area->geographic_areas) {
|
||||
OpenAPI_list_for_each(location_area->geographic_areas, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(location_area->geographic_areas);
|
||||
location_area->geographic_areas = NULL;
|
||||
}
|
||||
OpenAPI_list_free(location_area->geographic_areas);
|
||||
OpenAPI_list_for_each(location_area->civic_addresses, node) {
|
||||
OpenAPI_civic_address_free(node->data);
|
||||
if (location_area->civic_addresses) {
|
||||
OpenAPI_list_for_each(location_area->civic_addresses, node) {
|
||||
OpenAPI_civic_address_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(location_area->civic_addresses);
|
||||
location_area->civic_addresses = NULL;
|
||||
}
|
||||
if (location_area->nw_area_info) {
|
||||
OpenAPI_network_area_info_free(location_area->nw_area_info);
|
||||
location_area->nw_area_info = NULL;
|
||||
}
|
||||
OpenAPI_list_free(location_area->civic_addresses);
|
||||
OpenAPI_network_area_info_free(location_area->nw_area_info);
|
||||
ogs_free(location_area);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_area)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (location_area == NULL) {
|
||||
ogs_error("OpenAPI_location_area_convertToJSON() failed [LocationArea]");
|
||||
|
|
@ -54,17 +65,13 @@ cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_are
|
|||
ogs_error("OpenAPI_location_area_convertToJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *geographic_areas_node;
|
||||
if (location_area->geographic_areas) {
|
||||
OpenAPI_list_for_each(location_area->geographic_areas, geographic_areas_node) {
|
||||
cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(geographic_areas_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_location_area_convertToJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(geographic_areasList, itemLocal);
|
||||
OpenAPI_list_for_each(location_area->geographic_areas, node) {
|
||||
cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_location_area_convertToJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(geographic_areasList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,17 +81,13 @@ cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_are
|
|||
ogs_error("OpenAPI_location_area_convertToJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *civic_addresses_node;
|
||||
if (location_area->civic_addresses) {
|
||||
OpenAPI_list_for_each(location_area->civic_addresses, civic_addresses_node) {
|
||||
cJSON *itemLocal = OpenAPI_civic_address_convertToJSON(civic_addresses_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_location_area_convertToJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(civic_addressesList, itemLocal);
|
||||
OpenAPI_list_for_each(location_area->civic_addresses, node) {
|
||||
cJSON *itemLocal = OpenAPI_civic_address_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_location_area_convertToJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(civic_addressesList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,67 +111,64 @@ end:
|
|||
OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_areaJSON)
|
||||
{
|
||||
OpenAPI_location_area_t *location_area_local_var = NULL;
|
||||
cJSON *geographic_areas = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "geographicAreas");
|
||||
|
||||
OpenAPI_list_t *geographic_areasList;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *geographic_areas = NULL;
|
||||
OpenAPI_list_t *geographic_areasList = NULL;
|
||||
cJSON *civic_addresses = NULL;
|
||||
OpenAPI_list_t *civic_addressesList = NULL;
|
||||
cJSON *nw_area_info = NULL;
|
||||
OpenAPI_network_area_info_t *nw_area_info_local_nonprim = NULL;
|
||||
geographic_areas = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "geographicAreas");
|
||||
if (geographic_areas) {
|
||||
cJSON *geographic_areas_local_nonprimitive;
|
||||
if (!cJSON_IsArray(geographic_areas)){
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
geographic_areasList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(geographic_areas_local_nonprimitive, geographic_areas ) {
|
||||
if (!cJSON_IsObject(geographic_areas_local_nonprimitive)) {
|
||||
cJSON *geographic_areas_local = NULL;
|
||||
if (!cJSON_IsArray(geographic_areas)) {
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_geographic_area_t *geographic_areasItem = OpenAPI_geographic_area_parseFromJSON(geographic_areas_local_nonprimitive);
|
||||
|
||||
if (!geographic_areasItem) {
|
||||
ogs_error("No geographic_areasItem");
|
||||
OpenAPI_list_free(geographic_areasList);
|
||||
goto end;
|
||||
geographic_areasList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(geographic_areas_local, geographic_areas) {
|
||||
if (!cJSON_IsObject(geographic_areas_local)) {
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [geographic_areas]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_geographic_area_t *geographic_areasItem = OpenAPI_geographic_area_parseFromJSON(geographic_areas_local);
|
||||
if (!geographic_areasItem) {
|
||||
ogs_error("No geographic_areasItem");
|
||||
OpenAPI_list_free(geographic_areasList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(geographic_areasList, geographic_areasItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(geographic_areasList, geographic_areasItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *civic_addresses = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "civicAddresses");
|
||||
|
||||
OpenAPI_list_t *civic_addressesList;
|
||||
civic_addresses = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "civicAddresses");
|
||||
if (civic_addresses) {
|
||||
cJSON *civic_addresses_local_nonprimitive;
|
||||
if (!cJSON_IsArray(civic_addresses)){
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
civic_addressesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(civic_addresses_local_nonprimitive, civic_addresses ) {
|
||||
if (!cJSON_IsObject(civic_addresses_local_nonprimitive)) {
|
||||
cJSON *civic_addresses_local = NULL;
|
||||
if (!cJSON_IsArray(civic_addresses)) {
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_civic_address_t *civic_addressesItem = OpenAPI_civic_address_parseFromJSON(civic_addresses_local_nonprimitive);
|
||||
|
||||
if (!civic_addressesItem) {
|
||||
ogs_error("No civic_addressesItem");
|
||||
OpenAPI_list_free(civic_addressesList);
|
||||
goto end;
|
||||
civic_addressesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(civic_addresses_local, civic_addresses) {
|
||||
if (!cJSON_IsObject(civic_addresses_local)) {
|
||||
ogs_error("OpenAPI_location_area_parseFromJSON() failed [civic_addresses]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_civic_address_t *civic_addressesItem = OpenAPI_civic_address_parseFromJSON(civic_addresses_local);
|
||||
if (!civic_addressesItem) {
|
||||
ogs_error("No civic_addressesItem");
|
||||
OpenAPI_list_free(civic_addressesList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(civic_addressesList, civic_addressesItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(civic_addressesList, civic_addressesItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *nw_area_info = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "nwAreaInfo");
|
||||
|
||||
OpenAPI_network_area_info_t *nw_area_info_local_nonprim = NULL;
|
||||
nw_area_info = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "nwAreaInfo");
|
||||
if (nw_area_info) {
|
||||
nw_area_info_local_nonprim = OpenAPI_network_area_info_parseFromJSON(nw_area_info);
|
||||
}
|
||||
|
|
@ -181,6 +181,24 @@ OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_are
|
|||
|
||||
return location_area_local_var;
|
||||
end:
|
||||
if (geographic_areasList) {
|
||||
OpenAPI_list_for_each(geographic_areasList, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(geographic_areasList);
|
||||
geographic_areasList = NULL;
|
||||
}
|
||||
if (civic_addressesList) {
|
||||
OpenAPI_list_for_each(civic_addressesList, node) {
|
||||
OpenAPI_civic_address_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(civic_addressesList);
|
||||
civic_addressesList = NULL;
|
||||
}
|
||||
if (nw_area_info_local_nonprim) {
|
||||
OpenAPI_network_area_info_free(nw_area_info_local_nonprim);
|
||||
nw_area_info_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue