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
|
|
@ -18,20 +18,25 @@ OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_create(
|
|||
|
||||
void OpenAPI_area_of_validity_free(OpenAPI_area_of_validity_t *area_of_validity)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == area_of_validity) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(area_of_validity->tai_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
if (area_of_validity->tai_list) {
|
||||
OpenAPI_list_for_each(area_of_validity->tai_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(area_of_validity->tai_list);
|
||||
area_of_validity->tai_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(area_of_validity->tai_list);
|
||||
ogs_free(area_of_validity);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_area_of_validity_convertToJSON(OpenAPI_area_of_validity_t *area_of_validity)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (area_of_validity == NULL) {
|
||||
ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [AreaOfValidity]");
|
||||
|
|
@ -39,22 +44,22 @@ cJSON *OpenAPI_area_of_validity_convertToJSON(OpenAPI_area_of_validity_t *area_o
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!area_of_validity->tai_list) {
|
||||
ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList");
|
||||
if (tai_listList == NULL) {
|
||||
ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *tai_list_node;
|
||||
if (area_of_validity->tai_list) {
|
||||
OpenAPI_list_for_each(area_of_validity->tai_list, tai_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_listList, itemLocal);
|
||||
OpenAPI_list_for_each(area_of_validity->tai_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_area_of_validity_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_listList, itemLocal);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -64,43 +69,49 @@ end:
|
|||
OpenAPI_area_of_validity_t *OpenAPI_area_of_validity_parseFromJSON(cJSON *area_of_validityJSON)
|
||||
{
|
||||
OpenAPI_area_of_validity_t *area_of_validity_local_var = NULL;
|
||||
cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(area_of_validityJSON, "taiList");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *tai_list = NULL;
|
||||
OpenAPI_list_t *tai_listList = NULL;
|
||||
tai_list = cJSON_GetObjectItemCaseSensitive(area_of_validityJSON, "taiList");
|
||||
if (!tai_list) {
|
||||
ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *tai_listList;
|
||||
cJSON *tai_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(tai_list)){
|
||||
ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
tai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) {
|
||||
if (!cJSON_IsObject(tai_list_local_nonprimitive)) {
|
||||
cJSON *tai_list_local = NULL;
|
||||
if (!cJSON_IsArray(tai_list)) {
|
||||
ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive);
|
||||
|
||||
if (!tai_listItem) {
|
||||
ogs_error("No tai_listItem");
|
||||
OpenAPI_list_free(tai_listList);
|
||||
goto end;
|
||||
tai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_list_local, tai_list) {
|
||||
if (!cJSON_IsObject(tai_list_local)) {
|
||||
ogs_error("OpenAPI_area_of_validity_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local);
|
||||
if (!tai_listItem) {
|
||||
ogs_error("No tai_listItem");
|
||||
OpenAPI_list_free(tai_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(tai_listList, tai_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(tai_listList, tai_listItem);
|
||||
}
|
||||
|
||||
area_of_validity_local_var = OpenAPI_area_of_validity_create (
|
||||
tai_listList
|
||||
);
|
||||
|
||||
return area_of_validity_local_var;
|
||||
end:
|
||||
if (tai_listList) {
|
||||
OpenAPI_list_for_each(tai_listList, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(tai_listList);
|
||||
tai_listList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue