[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,18 +24,26 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_create(
void OpenAPI_plmn_ec_info_free(OpenAPI_plmn_ec_info_t *plmn_ec_info)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == plmn_ec_info) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_plmn_id_free(plmn_ec_info->plmn_id);
OpenAPI_ec_restriction_data_wb_free(plmn_ec_info->ec_restriction_data_wb);
if (plmn_ec_info->plmn_id) {
OpenAPI_plmn_id_free(plmn_ec_info->plmn_id);
plmn_ec_info->plmn_id = NULL;
}
if (plmn_ec_info->ec_restriction_data_wb) {
OpenAPI_ec_restriction_data_wb_free(plmn_ec_info->ec_restriction_data_wb);
plmn_ec_info->ec_restriction_data_wb = NULL;
}
ogs_free(plmn_ec_info);
}
cJSON *OpenAPI_plmn_ec_info_convertToJSON(OpenAPI_plmn_ec_info_t *plmn_ec_info)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (plmn_ec_info == NULL) {
ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [PlmnEcInfo]");
@ -43,6 +51,10 @@ cJSON *OpenAPI_plmn_ec_info_convertToJSON(OpenAPI_plmn_ec_info_t *plmn_ec_info)
}
item = cJSON_CreateObject();
if (!plmn_ec_info->plmn_id) {
ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [plmn_id]");
return NULL;
}
cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(plmn_ec_info->plmn_id);
if (plmn_id_local_JSON == NULL) {
ogs_error("OpenAPI_plmn_ec_info_convertToJSON() failed [plmn_id]");
@ -81,24 +93,25 @@ end:
OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_parseFromJSON(cJSON *plmn_ec_infoJSON)
{
OpenAPI_plmn_ec_info_t *plmn_ec_info_local_var = NULL;
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "plmnId");
OpenAPI_lnode_t *node = NULL;
cJSON *plmn_id = NULL;
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
cJSON *ec_restriction_data_wb = NULL;
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL;
cJSON *ec_restriction_data_nb = NULL;
plmn_id = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "plmnId");
if (!plmn_id) {
ogs_error("OpenAPI_plmn_ec_info_parseFromJSON() failed [plmn_id]");
goto end;
}
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id);
cJSON *ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataWb");
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL;
ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataWb");
if (ec_restriction_data_wb) {
ec_restriction_data_wb_local_nonprim = OpenAPI_ec_restriction_data_wb_parseFromJSON(ec_restriction_data_wb);
}
cJSON *ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataNb");
ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(plmn_ec_infoJSON, "ecRestrictionDataNb");
if (ec_restriction_data_nb) {
if (!cJSON_IsBool(ec_restriction_data_nb)) {
ogs_error("OpenAPI_plmn_ec_info_parseFromJSON() failed [ec_restriction_data_nb]");
@ -115,6 +128,14 @@ OpenAPI_plmn_ec_info_t *OpenAPI_plmn_ec_info_parseFromJSON(cJSON *plmn_ec_infoJS
return plmn_ec_info_local_var;
end:
if (plmn_id_local_nonprim) {
OpenAPI_plmn_id_free(plmn_id_local_nonprim);
plmn_id_local_nonprim = NULL;
}
if (ec_restriction_data_wb_local_nonprim) {
OpenAPI_ec_restriction_data_wb_free(ec_restriction_data_wb_local_nonprim);
ec_restriction_data_wb_local_nonprim = NULL;
}
return NULL;
}