mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 15:24:14 +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
|
|
@ -20,18 +20,26 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_create(
|
|||
|
||||
void OpenAPI_smsf_info_free(OpenAPI_smsf_info_t *smsf_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == smsf_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(smsf_info->smsf_instance_id);
|
||||
OpenAPI_plmn_id_free(smsf_info->plmn_id);
|
||||
if (smsf_info->smsf_instance_id) {
|
||||
ogs_free(smsf_info->smsf_instance_id);
|
||||
smsf_info->smsf_instance_id = NULL;
|
||||
}
|
||||
if (smsf_info->plmn_id) {
|
||||
OpenAPI_plmn_id_free(smsf_info->plmn_id);
|
||||
smsf_info->plmn_id = NULL;
|
||||
}
|
||||
ogs_free(smsf_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_smsf_info_convertToJSON(OpenAPI_smsf_info_t *smsf_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (smsf_info == NULL) {
|
||||
ogs_error("OpenAPI_smsf_info_convertToJSON() failed [SmsfInfo]");
|
||||
|
|
@ -39,11 +47,19 @@ cJSON *OpenAPI_smsf_info_convertToJSON(OpenAPI_smsf_info_t *smsf_info)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!smsf_info->smsf_instance_id) {
|
||||
ogs_error("OpenAPI_smsf_info_convertToJSON() failed [smsf_instance_id]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "smsfInstanceId", smsf_info->smsf_instance_id) == NULL) {
|
||||
ogs_error("OpenAPI_smsf_info_convertToJSON() failed [smsf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!smsf_info->plmn_id) {
|
||||
ogs_error("OpenAPI_smsf_info_convertToJSON() failed [plmn_id]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(smsf_info->plmn_id);
|
||||
if (plmn_id_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_smsf_info_convertToJSON() failed [plmn_id]");
|
||||
|
|
@ -62,24 +78,25 @@ end:
|
|||
OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON)
|
||||
{
|
||||
OpenAPI_smsf_info_t *smsf_info_local_var = NULL;
|
||||
cJSON *smsf_instance_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "smsfInstanceId");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *smsf_instance_id = NULL;
|
||||
cJSON *plmn_id = NULL;
|
||||
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
|
||||
smsf_instance_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "smsfInstanceId");
|
||||
if (!smsf_instance_id) {
|
||||
ogs_error("OpenAPI_smsf_info_parseFromJSON() failed [smsf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(smsf_instance_id)) {
|
||||
ogs_error("OpenAPI_smsf_info_parseFromJSON() failed [smsf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "plmnId");
|
||||
plmn_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "plmnId");
|
||||
if (!plmn_id) {
|
||||
ogs_error("OpenAPI_smsf_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);
|
||||
|
||||
smsf_info_local_var = OpenAPI_smsf_info_create (
|
||||
|
|
@ -89,6 +106,10 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON)
|
|||
|
||||
return smsf_info_local_var;
|
||||
end:
|
||||
if (plmn_id_local_nonprim) {
|
||||
OpenAPI_plmn_id_free(plmn_id_local_nonprim);
|
||||
plmn_id_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue