mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +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_ambr_rm_t *OpenAPI_ambr_rm_create(
|
|||
|
||||
void OpenAPI_ambr_rm_free(OpenAPI_ambr_rm_t *ambr_rm)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == ambr_rm) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ambr_rm->uplink);
|
||||
ogs_free(ambr_rm->downlink);
|
||||
if (ambr_rm->uplink) {
|
||||
ogs_free(ambr_rm->uplink);
|
||||
ambr_rm->uplink = NULL;
|
||||
}
|
||||
if (ambr_rm->downlink) {
|
||||
ogs_free(ambr_rm->downlink);
|
||||
ambr_rm->downlink = NULL;
|
||||
}
|
||||
ogs_free(ambr_rm);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_ambr_rm_convertToJSON(OpenAPI_ambr_rm_t *ambr_rm)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (ambr_rm == NULL) {
|
||||
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [AmbrRm]");
|
||||
|
|
@ -39,11 +47,19 @@ cJSON *OpenAPI_ambr_rm_convertToJSON(OpenAPI_ambr_rm_t *ambr_rm)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!ambr_rm->uplink) {
|
||||
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [uplink]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "uplink", ambr_rm->uplink) == NULL) {
|
||||
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [uplink]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ambr_rm->downlink) {
|
||||
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [downlink]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "downlink", ambr_rm->downlink) == NULL) {
|
||||
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [downlink]");
|
||||
goto end;
|
||||
|
|
@ -56,23 +72,24 @@ end:
|
|||
OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_parseFromJSON(cJSON *ambr_rmJSON)
|
||||
{
|
||||
OpenAPI_ambr_rm_t *ambr_rm_local_var = NULL;
|
||||
cJSON *uplink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "uplink");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *uplink = NULL;
|
||||
cJSON *downlink = NULL;
|
||||
uplink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "uplink");
|
||||
if (!uplink) {
|
||||
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [uplink]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(uplink)) {
|
||||
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [uplink]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *downlink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "downlink");
|
||||
downlink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "downlink");
|
||||
if (!downlink) {
|
||||
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [downlink]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(downlink)) {
|
||||
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [downlink]");
|
||||
goto end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue