[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

@ -18,23 +18,28 @@ OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_create(
void OpenAPI_eps_interworking_info_free(OpenAPI_eps_interworking_info_t *eps_interworking_info)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == eps_interworking_info) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
ogs_free(localKeyValue->key);
OpenAPI_eps_iwk_pgw_free(localKeyValue->value);
ogs_free(localKeyValue);
if (eps_interworking_info->eps_iwk_pgws) {
OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
ogs_free(localKeyValue->key);
OpenAPI_eps_iwk_pgw_free(localKeyValue->value);
OpenAPI_map_free(localKeyValue);
}
OpenAPI_list_free(eps_interworking_info->eps_iwk_pgws);
eps_interworking_info->eps_iwk_pgws = NULL;
}
OpenAPI_list_free(eps_interworking_info->eps_iwk_pgws);
ogs_free(eps_interworking_info);
}
cJSON *OpenAPI_eps_interworking_info_convertToJSON(OpenAPI_eps_interworking_info_t *eps_interworking_info)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (eps_interworking_info == NULL) {
ogs_error("OpenAPI_eps_interworking_info_convertToJSON() failed [EpsInterworkingInfo]");
@ -49,21 +54,20 @@ cJSON *OpenAPI_eps_interworking_info_convertToJSON(OpenAPI_eps_interworking_info
goto end;
}
cJSON *localMapObject = eps_iwk_pgws;
OpenAPI_lnode_t *eps_iwk_pgws_node;
if (eps_interworking_info->eps_iwk_pgws) {
OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, eps_iwk_pgws_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)eps_iwk_pgws_node->data;
cJSON *itemLocal = localKeyValue->value ?
OpenAPI_eps_iwk_pgw_convertToJSON(localKeyValue->value) :
cJSON_CreateNull();
if (itemLocal == NULL) {
ogs_error("OpenAPI_eps_interworking_info_convertToJSON() failed [inner]");
goto end;
}
cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
OpenAPI_list_for_each(eps_interworking_info->eps_iwk_pgws, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
cJSON *itemLocal = localKeyValue->value ?
OpenAPI_eps_iwk_pgw_convertToJSON(localKeyValue->value) :
cJSON_CreateNull();
if (itemLocal == NULL) {
ogs_error("OpenAPI_eps_interworking_info_convertToJSON() failed [inner]");
goto end;
}
cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
}
}
}
end:
return item;
@ -72,30 +76,33 @@ end:
OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_parseFromJSON(cJSON *eps_interworking_infoJSON)
{
OpenAPI_eps_interworking_info_t *eps_interworking_info_local_var = NULL;
cJSON *eps_iwk_pgws = cJSON_GetObjectItemCaseSensitive(eps_interworking_infoJSON, "epsIwkPgws");
OpenAPI_list_t *eps_iwk_pgwsList;
OpenAPI_lnode_t *node = NULL;
cJSON *eps_iwk_pgws = NULL;
OpenAPI_list_t *eps_iwk_pgwsList = NULL;
eps_iwk_pgws = cJSON_GetObjectItemCaseSensitive(eps_interworking_infoJSON, "epsIwkPgws");
if (eps_iwk_pgws) {
cJSON *eps_iwk_pgws_local_map;
if (!cJSON_IsObject(eps_iwk_pgws)) {
ogs_error("OpenAPI_eps_interworking_info_parseFromJSON() failed [eps_iwk_pgws]");
goto end;
}
eps_iwk_pgwsList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(eps_iwk_pgws_local_map, eps_iwk_pgws) {
cJSON *localMapObject = eps_iwk_pgws_local_map;
if (cJSON_IsObject(localMapObject)) {
localMapKeyPair = OpenAPI_map_create(
ogs_strdup(localMapObject->string), OpenAPI_eps_iwk_pgw_parseFromJSON(localMapObject));
} else if (cJSON_IsNull(localMapObject)) {
localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
} else {
ogs_error("OpenAPI_eps_interworking_info_parseFromJSON() failed [inner]");
cJSON *eps_iwk_pgws_local_map = NULL;
if (!cJSON_IsObject(eps_iwk_pgws) && !cJSON_IsNull(eps_iwk_pgws)) {
ogs_error("OpenAPI_eps_interworking_info_parseFromJSON() failed [eps_iwk_pgws]");
goto end;
}
OpenAPI_list_add(eps_iwk_pgwsList, localMapKeyPair);
}
if (cJSON_IsObject(eps_iwk_pgws)) {
eps_iwk_pgwsList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(eps_iwk_pgws_local_map, eps_iwk_pgws) {
cJSON *localMapObject = eps_iwk_pgws_local_map;
if (cJSON_IsObject(localMapObject)) {
localMapKeyPair = OpenAPI_map_create(
ogs_strdup(localMapObject->string), OpenAPI_eps_iwk_pgw_parseFromJSON(localMapObject));
} else if (cJSON_IsNull(localMapObject)) {
localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
} else {
ogs_error("OpenAPI_eps_interworking_info_parseFromJSON() failed [inner]");
goto end;
}
OpenAPI_list_add(eps_iwk_pgwsList, localMapKeyPair);
}
}
}
eps_interworking_info_local_var = OpenAPI_eps_interworking_info_create (
@ -104,6 +111,16 @@ OpenAPI_eps_interworking_info_t *OpenAPI_eps_interworking_info_parseFromJSON(cJS
return eps_interworking_info_local_var;
end:
if (eps_iwk_pgwsList) {
OpenAPI_list_for_each(eps_iwk_pgwsList, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data;
ogs_free(localKeyValue->key);
OpenAPI_eps_iwk_pgw_free(localKeyValue->value);
OpenAPI_map_free(localKeyValue);
}
OpenAPI_list_free(eps_iwk_pgwsList);
eps_iwk_pgwsList = NULL;
}
return NULL;
}