mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 13:50:08 +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_modification_notification_t *OpenAPI_modification_notification_create(
|
|||
|
||||
void OpenAPI_modification_notification_free(OpenAPI_modification_notification_t *modification_notification)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == modification_notification) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(modification_notification->notify_items, node) {
|
||||
OpenAPI_notify_item_free(node->data);
|
||||
if (modification_notification->notify_items) {
|
||||
OpenAPI_list_for_each(modification_notification->notify_items, node) {
|
||||
OpenAPI_notify_item_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(modification_notification->notify_items);
|
||||
modification_notification->notify_items = NULL;
|
||||
}
|
||||
OpenAPI_list_free(modification_notification->notify_items);
|
||||
ogs_free(modification_notification);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_modification_notification_convertToJSON(OpenAPI_modification_notification_t *modification_notification)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (modification_notification == NULL) {
|
||||
ogs_error("OpenAPI_modification_notification_convertToJSON() failed [ModificationNotification]");
|
||||
|
|
@ -39,22 +44,22 @@ cJSON *OpenAPI_modification_notification_convertToJSON(OpenAPI_modification_noti
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!modification_notification->notify_items) {
|
||||
ogs_error("OpenAPI_modification_notification_convertToJSON() failed [notify_items]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *notify_itemsList = cJSON_AddArrayToObject(item, "notifyItems");
|
||||
if (notify_itemsList == NULL) {
|
||||
ogs_error("OpenAPI_modification_notification_convertToJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *notify_items_node;
|
||||
if (modification_notification->notify_items) {
|
||||
OpenAPI_list_for_each(modification_notification->notify_items, notify_items_node) {
|
||||
cJSON *itemLocal = OpenAPI_notify_item_convertToJSON(notify_items_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_modification_notification_convertToJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(notify_itemsList, itemLocal);
|
||||
OpenAPI_list_for_each(modification_notification->notify_items, node) {
|
||||
cJSON *itemLocal = OpenAPI_notify_item_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_modification_notification_convertToJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(notify_itemsList, itemLocal);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -64,43 +69,49 @@ end:
|
|||
OpenAPI_modification_notification_t *OpenAPI_modification_notification_parseFromJSON(cJSON *modification_notificationJSON)
|
||||
{
|
||||
OpenAPI_modification_notification_t *modification_notification_local_var = NULL;
|
||||
cJSON *notify_items = cJSON_GetObjectItemCaseSensitive(modification_notificationJSON, "notifyItems");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *notify_items = NULL;
|
||||
OpenAPI_list_t *notify_itemsList = NULL;
|
||||
notify_items = cJSON_GetObjectItemCaseSensitive(modification_notificationJSON, "notifyItems");
|
||||
if (!notify_items) {
|
||||
ogs_error("OpenAPI_modification_notification_parseFromJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *notify_itemsList;
|
||||
cJSON *notify_items_local_nonprimitive;
|
||||
if (!cJSON_IsArray(notify_items)){
|
||||
ogs_error("OpenAPI_modification_notification_parseFromJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
notify_itemsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(notify_items_local_nonprimitive, notify_items ) {
|
||||
if (!cJSON_IsObject(notify_items_local_nonprimitive)) {
|
||||
cJSON *notify_items_local = NULL;
|
||||
if (!cJSON_IsArray(notify_items)) {
|
||||
ogs_error("OpenAPI_modification_notification_parseFromJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_notify_item_t *notify_itemsItem = OpenAPI_notify_item_parseFromJSON(notify_items_local_nonprimitive);
|
||||
|
||||
if (!notify_itemsItem) {
|
||||
ogs_error("No notify_itemsItem");
|
||||
OpenAPI_list_free(notify_itemsList);
|
||||
goto end;
|
||||
notify_itemsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(notify_items_local, notify_items) {
|
||||
if (!cJSON_IsObject(notify_items_local)) {
|
||||
ogs_error("OpenAPI_modification_notification_parseFromJSON() failed [notify_items]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_notify_item_t *notify_itemsItem = OpenAPI_notify_item_parseFromJSON(notify_items_local);
|
||||
if (!notify_itemsItem) {
|
||||
ogs_error("No notify_itemsItem");
|
||||
OpenAPI_list_free(notify_itemsList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(notify_itemsList, notify_itemsItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(notify_itemsList, notify_itemsItem);
|
||||
}
|
||||
|
||||
modification_notification_local_var = OpenAPI_modification_notification_create (
|
||||
notify_itemsList
|
||||
);
|
||||
|
||||
return modification_notification_local_var;
|
||||
end:
|
||||
if (notify_itemsList) {
|
||||
OpenAPI_list_for_each(notify_itemsList, node) {
|
||||
OpenAPI_notify_item_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(notify_itemsList);
|
||||
notify_itemsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue