mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 07:08:11 +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
|
|
@ -22,19 +22,30 @@ OpenAPI_tai_1_t *OpenAPI_tai_1_create(
|
|||
|
||||
void OpenAPI_tai_1_free(OpenAPI_tai_1_t *tai_1)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == tai_1) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_plmn_id_1_free(tai_1->plmn_id);
|
||||
ogs_free(tai_1->tac);
|
||||
ogs_free(tai_1->nid);
|
||||
if (tai_1->plmn_id) {
|
||||
OpenAPI_plmn_id_1_free(tai_1->plmn_id);
|
||||
tai_1->plmn_id = NULL;
|
||||
}
|
||||
if (tai_1->tac) {
|
||||
ogs_free(tai_1->tac);
|
||||
tai_1->tac = NULL;
|
||||
}
|
||||
if (tai_1->nid) {
|
||||
ogs_free(tai_1->nid);
|
||||
tai_1->nid = NULL;
|
||||
}
|
||||
ogs_free(tai_1);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_tai_1_convertToJSON(OpenAPI_tai_1_t *tai_1)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (tai_1 == NULL) {
|
||||
ogs_error("OpenAPI_tai_1_convertToJSON() failed [Tai_1]");
|
||||
|
|
@ -42,6 +53,10 @@ cJSON *OpenAPI_tai_1_convertToJSON(OpenAPI_tai_1_t *tai_1)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!tai_1->plmn_id) {
|
||||
ogs_error("OpenAPI_tai_1_convertToJSON() failed [plmn_id]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(tai_1->plmn_id);
|
||||
if (plmn_id_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_tai_1_convertToJSON() failed [plmn_id]");
|
||||
|
|
@ -53,6 +68,10 @@ cJSON *OpenAPI_tai_1_convertToJSON(OpenAPI_tai_1_t *tai_1)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (!tai_1->tac) {
|
||||
ogs_error("OpenAPI_tai_1_convertToJSON() failed [tac]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "tac", tai_1->tac) == NULL) {
|
||||
ogs_error("OpenAPI_tai_1_convertToJSON() failed [tac]");
|
||||
goto end;
|
||||
|
|
@ -72,30 +91,31 @@ end:
|
|||
OpenAPI_tai_1_t *OpenAPI_tai_1_parseFromJSON(cJSON *tai_1JSON)
|
||||
{
|
||||
OpenAPI_tai_1_t *tai_1_local_var = NULL;
|
||||
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "plmnId");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *plmn_id = NULL;
|
||||
OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL;
|
||||
cJSON *tac = NULL;
|
||||
cJSON *nid = NULL;
|
||||
plmn_id = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "plmnId");
|
||||
if (!plmn_id) {
|
||||
ogs_error("OpenAPI_tai_1_parseFromJSON() failed [plmn_id]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL;
|
||||
plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id);
|
||||
|
||||
cJSON *tac = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "tac");
|
||||
tac = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "tac");
|
||||
if (!tac) {
|
||||
ogs_error("OpenAPI_tai_1_parseFromJSON() failed [tac]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(tac)) {
|
||||
ogs_error("OpenAPI_tai_1_parseFromJSON() failed [tac]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *nid = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "nid");
|
||||
|
||||
nid = cJSON_GetObjectItemCaseSensitive(tai_1JSON, "nid");
|
||||
if (nid) {
|
||||
if (!cJSON_IsString(nid)) {
|
||||
if (!cJSON_IsString(nid) && !cJSON_IsNull(nid)) {
|
||||
ogs_error("OpenAPI_tai_1_parseFromJSON() failed [nid]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -104,11 +124,15 @@ OpenAPI_tai_1_t *OpenAPI_tai_1_parseFromJSON(cJSON *tai_1JSON)
|
|||
tai_1_local_var = OpenAPI_tai_1_create (
|
||||
plmn_id_local_nonprim,
|
||||
ogs_strdup(tac->valuestring),
|
||||
nid ? ogs_strdup(nid->valuestring) : NULL
|
||||
nid && !cJSON_IsNull(nid) ? ogs_strdup(nid->valuestring) : NULL
|
||||
);
|
||||
|
||||
return tai_1_local_var;
|
||||
end:
|
||||
if (plmn_id_local_nonprim) {
|
||||
OpenAPI_plmn_id_1_free(plmn_id_local_nonprim);
|
||||
plmn_id_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue