[SBI] Crash occurs when ENUM in the MAP (#2103)

This commit is contained in:
Sukchan Lee 2023-03-01 17:50:25 +09:00
parent ce668c556c
commit 969c116e77
1097 changed files with 266728 additions and 42047 deletions

View file

@ -24,26 +24,40 @@ OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notifi
void OpenAPI_exposure_data_change_notification_free(OpenAPI_exposure_data_change_notification_t *exposure_data_change_notification)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == exposure_data_change_notification) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(exposure_data_change_notification->ue_id);
OpenAPI_access_and_mobility_data_free(exposure_data_change_notification->access_and_mobility_data);
OpenAPI_list_for_each(exposure_data_change_notification->pdu_session_management_data, node) {
OpenAPI_pdu_session_management_data_free(node->data);
if (exposure_data_change_notification->ue_id) {
ogs_free(exposure_data_change_notification->ue_id);
exposure_data_change_notification->ue_id = NULL;
}
OpenAPI_list_free(exposure_data_change_notification->pdu_session_management_data);
OpenAPI_list_for_each(exposure_data_change_notification->del_resources, node) {
ogs_free(node->data);
if (exposure_data_change_notification->access_and_mobility_data) {
OpenAPI_access_and_mobility_data_free(exposure_data_change_notification->access_and_mobility_data);
exposure_data_change_notification->access_and_mobility_data = NULL;
}
if (exposure_data_change_notification->pdu_session_management_data) {
OpenAPI_list_for_each(exposure_data_change_notification->pdu_session_management_data, node) {
OpenAPI_pdu_session_management_data_free(node->data);
}
OpenAPI_list_free(exposure_data_change_notification->pdu_session_management_data);
exposure_data_change_notification->pdu_session_management_data = NULL;
}
if (exposure_data_change_notification->del_resources) {
OpenAPI_list_for_each(exposure_data_change_notification->del_resources, node) {
ogs_free(node->data);
}
OpenAPI_list_free(exposure_data_change_notification->del_resources);
exposure_data_change_notification->del_resources = NULL;
}
OpenAPI_list_free(exposure_data_change_notification->del_resources);
ogs_free(exposure_data_change_notification);
}
cJSON *OpenAPI_exposure_data_change_notification_convertToJSON(OpenAPI_exposure_data_change_notification_t *exposure_data_change_notification)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (exposure_data_change_notification == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [ExposureDataChangeNotification]");
@ -77,34 +91,28 @@ cJSON *OpenAPI_exposure_data_change_notification_convertToJSON(OpenAPI_exposure_
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [pdu_session_management_data]");
goto end;
}
OpenAPI_lnode_t *pdu_session_management_data_node;
if (exposure_data_change_notification->pdu_session_management_data) {
OpenAPI_list_for_each(exposure_data_change_notification->pdu_session_management_data, pdu_session_management_data_node) {
cJSON *itemLocal = OpenAPI_pdu_session_management_data_convertToJSON(pdu_session_management_data_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [pdu_session_management_data]");
goto end;
}
cJSON_AddItemToArray(pdu_session_management_dataList, itemLocal);
OpenAPI_list_for_each(exposure_data_change_notification->pdu_session_management_data, node) {
cJSON *itemLocal = OpenAPI_pdu_session_management_data_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [pdu_session_management_data]");
goto end;
}
cJSON_AddItemToArray(pdu_session_management_dataList, itemLocal);
}
}
if (exposure_data_change_notification->del_resources) {
cJSON *del_resources = cJSON_AddArrayToObject(item, "delResources");
if (del_resources == NULL) {
cJSON *del_resourcesList = cJSON_AddArrayToObject(item, "delResources");
if (del_resourcesList == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [del_resources]");
goto end;
}
OpenAPI_lnode_t *del_resources_node;
OpenAPI_list_for_each(exposure_data_change_notification->del_resources, del_resources_node) {
if (cJSON_AddStringToObject(del_resources, "", (char*)del_resources_node->data) == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [del_resources]");
goto end;
OpenAPI_list_for_each(exposure_data_change_notification->del_resources, node) {
if (cJSON_AddStringToObject(del_resourcesList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_exposure_data_change_notification_convertToJSON() failed [del_resources]");
goto end;
}
}
}
}
end:
@ -114,73 +122,75 @@ end:
OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notification_parseFromJSON(cJSON *exposure_data_change_notificationJSON)
{
OpenAPI_exposure_data_change_notification_t *exposure_data_change_notification_local_var = NULL;
cJSON *ue_id = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "ueId");
OpenAPI_lnode_t *node = NULL;
cJSON *ue_id = NULL;
cJSON *access_and_mobility_data = NULL;
OpenAPI_access_and_mobility_data_t *access_and_mobility_data_local_nonprim = NULL;
cJSON *pdu_session_management_data = NULL;
OpenAPI_list_t *pdu_session_management_dataList = NULL;
cJSON *del_resources = NULL;
OpenAPI_list_t *del_resourcesList = NULL;
ue_id = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "ueId");
if (ue_id) {
if (!cJSON_IsString(ue_id)) {
if (!cJSON_IsString(ue_id) && !cJSON_IsNull(ue_id)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [ue_id]");
goto end;
}
}
cJSON *access_and_mobility_data = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "accessAndMobilityData");
OpenAPI_access_and_mobility_data_t *access_and_mobility_data_local_nonprim = NULL;
access_and_mobility_data = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "accessAndMobilityData");
if (access_and_mobility_data) {
access_and_mobility_data_local_nonprim = OpenAPI_access_and_mobility_data_parseFromJSON(access_and_mobility_data);
}
cJSON *pdu_session_management_data = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "pduSessionManagementData");
OpenAPI_list_t *pdu_session_management_dataList;
pdu_session_management_data = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "pduSessionManagementData");
if (pdu_session_management_data) {
cJSON *pdu_session_management_data_local_nonprimitive;
if (!cJSON_IsArray(pdu_session_management_data)){
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [pdu_session_management_data]");
goto end;
}
pdu_session_management_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(pdu_session_management_data_local_nonprimitive, pdu_session_management_data ) {
if (!cJSON_IsObject(pdu_session_management_data_local_nonprimitive)) {
cJSON *pdu_session_management_data_local = NULL;
if (!cJSON_IsArray(pdu_session_management_data)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [pdu_session_management_data]");
goto end;
}
OpenAPI_pdu_session_management_data_t *pdu_session_management_dataItem = OpenAPI_pdu_session_management_data_parseFromJSON(pdu_session_management_data_local_nonprimitive);
if (!pdu_session_management_dataItem) {
ogs_error("No pdu_session_management_dataItem");
OpenAPI_list_free(pdu_session_management_dataList);
pdu_session_management_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(pdu_session_management_data_local, pdu_session_management_data) {
if (!cJSON_IsObject(pdu_session_management_data_local)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [pdu_session_management_data]");
goto end;
}
OpenAPI_pdu_session_management_data_t *pdu_session_management_dataItem = OpenAPI_pdu_session_management_data_parseFromJSON(pdu_session_management_data_local);
if (!pdu_session_management_dataItem) {
ogs_error("No pdu_session_management_dataItem");
OpenAPI_list_free(pdu_session_management_dataList);
goto end;
}
OpenAPI_list_add(pdu_session_management_dataList, pdu_session_management_dataItem);
}
}
del_resources = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "delResources");
if (del_resources) {
cJSON *del_resources_local = NULL;
if (!cJSON_IsArray(del_resources)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [del_resources]");
goto end;
}
OpenAPI_list_add(pdu_session_management_dataList, pdu_session_management_dataItem);
}
}
del_resourcesList = OpenAPI_list_create();
cJSON *del_resources = cJSON_GetObjectItemCaseSensitive(exposure_data_change_notificationJSON, "delResources");
OpenAPI_list_t *del_resourcesList;
if (del_resources) {
cJSON *del_resources_local;
if (!cJSON_IsArray(del_resources)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [del_resources]");
goto end;
}
del_resourcesList = OpenAPI_list_create();
cJSON_ArrayForEach(del_resources_local, del_resources) {
if (!cJSON_IsString(del_resources_local)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [del_resources]");
goto end;
}
OpenAPI_list_add(del_resourcesList, ogs_strdup(del_resources_local->valuestring));
}
cJSON_ArrayForEach(del_resources_local, del_resources) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(del_resources_local)) {
ogs_error("OpenAPI_exposure_data_change_notification_parseFromJSON() failed [del_resources]");
goto end;
}
OpenAPI_list_add(del_resourcesList, ogs_strdup(del_resources_local->valuestring));
}
}
exposure_data_change_notification_local_var = OpenAPI_exposure_data_change_notification_create (
ue_id ? ogs_strdup(ue_id->valuestring) : NULL,
ue_id && !cJSON_IsNull(ue_id) ? ogs_strdup(ue_id->valuestring) : NULL,
access_and_mobility_data ? access_and_mobility_data_local_nonprim : NULL,
pdu_session_management_data ? pdu_session_management_dataList : NULL,
del_resources ? del_resourcesList : NULL
@ -188,6 +198,24 @@ OpenAPI_exposure_data_change_notification_t *OpenAPI_exposure_data_change_notifi
return exposure_data_change_notification_local_var;
end:
if (access_and_mobility_data_local_nonprim) {
OpenAPI_access_and_mobility_data_free(access_and_mobility_data_local_nonprim);
access_and_mobility_data_local_nonprim = NULL;
}
if (pdu_session_management_dataList) {
OpenAPI_list_for_each(pdu_session_management_dataList, node) {
OpenAPI_pdu_session_management_data_free(node->data);
}
OpenAPI_list_free(pdu_session_management_dataList);
pdu_session_management_dataList = NULL;
}
if (del_resourcesList) {
OpenAPI_list_for_each(del_resourcesList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(del_resourcesList);
del_resourcesList = NULL;
}
return NULL;
}