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
|
|
@ -28,19 +28,30 @@ OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_create(
|
|||
|
||||
void OpenAPI_alternative_qos_profile_free(OpenAPI_alternative_qos_profile_t *alternative_qos_profile)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == alternative_qos_profile) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(alternative_qos_profile->gua_fbr_dl);
|
||||
ogs_free(alternative_qos_profile->gua_fbr_ul);
|
||||
ogs_free(alternative_qos_profile->packet_err_rate);
|
||||
if (alternative_qos_profile->gua_fbr_dl) {
|
||||
ogs_free(alternative_qos_profile->gua_fbr_dl);
|
||||
alternative_qos_profile->gua_fbr_dl = NULL;
|
||||
}
|
||||
if (alternative_qos_profile->gua_fbr_ul) {
|
||||
ogs_free(alternative_qos_profile->gua_fbr_ul);
|
||||
alternative_qos_profile->gua_fbr_ul = NULL;
|
||||
}
|
||||
if (alternative_qos_profile->packet_err_rate) {
|
||||
ogs_free(alternative_qos_profile->packet_err_rate);
|
||||
alternative_qos_profile->packet_err_rate = NULL;
|
||||
}
|
||||
ogs_free(alternative_qos_profile);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_alternative_qos_profile_convertToJSON(OpenAPI_alternative_qos_profile_t *alternative_qos_profile)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (alternative_qos_profile == NULL) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [AlternativeQosProfile]");
|
||||
|
|
@ -88,37 +99,39 @@ end:
|
|||
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON(cJSON *alternative_qos_profileJSON)
|
||||
{
|
||||
OpenAPI_alternative_qos_profile_t *alternative_qos_profile_local_var = NULL;
|
||||
cJSON *index = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "index");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *index = NULL;
|
||||
cJSON *gua_fbr_dl = NULL;
|
||||
cJSON *gua_fbr_ul = NULL;
|
||||
cJSON *packet_delay_budget = NULL;
|
||||
cJSON *packet_err_rate = NULL;
|
||||
index = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "index");
|
||||
if (!index) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsNumber(index)) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrDl");
|
||||
|
||||
gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrDl");
|
||||
if (gua_fbr_dl) {
|
||||
if (!cJSON_IsString(gua_fbr_dl)) {
|
||||
if (!cJSON_IsString(gua_fbr_dl) && !cJSON_IsNull(gua_fbr_dl)) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_dl]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrUl");
|
||||
|
||||
gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrUl");
|
||||
if (gua_fbr_ul) {
|
||||
if (!cJSON_IsString(gua_fbr_ul)) {
|
||||
if (!cJSON_IsString(gua_fbr_ul) && !cJSON_IsNull(gua_fbr_ul)) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_ul]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *packet_delay_budget = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetDelayBudget");
|
||||
|
||||
packet_delay_budget = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetDelayBudget");
|
||||
if (packet_delay_budget) {
|
||||
if (!cJSON_IsNumber(packet_delay_budget)) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_delay_budget]");
|
||||
|
|
@ -126,10 +139,9 @@ OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON
|
|||
}
|
||||
}
|
||||
|
||||
cJSON *packet_err_rate = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetErrRate");
|
||||
|
||||
packet_err_rate = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetErrRate");
|
||||
if (packet_err_rate) {
|
||||
if (!cJSON_IsString(packet_err_rate)) {
|
||||
if (!cJSON_IsString(packet_err_rate) && !cJSON_IsNull(packet_err_rate)) {
|
||||
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_err_rate]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -138,11 +150,11 @@ OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON
|
|||
alternative_qos_profile_local_var = OpenAPI_alternative_qos_profile_create (
|
||||
|
||||
index->valuedouble,
|
||||
gua_fbr_dl ? ogs_strdup(gua_fbr_dl->valuestring) : NULL,
|
||||
gua_fbr_ul ? ogs_strdup(gua_fbr_ul->valuestring) : NULL,
|
||||
gua_fbr_dl && !cJSON_IsNull(gua_fbr_dl) ? ogs_strdup(gua_fbr_dl->valuestring) : NULL,
|
||||
gua_fbr_ul && !cJSON_IsNull(gua_fbr_ul) ? ogs_strdup(gua_fbr_ul->valuestring) : NULL,
|
||||
packet_delay_budget ? true : false,
|
||||
packet_delay_budget ? packet_delay_budget->valuedouble : 0,
|
||||
packet_err_rate ? ogs_strdup(packet_err_rate->valuestring) : NULL
|
||||
packet_err_rate && !cJSON_IsNull(packet_err_rate) ? ogs_strdup(packet_err_rate->valuestring) : NULL
|
||||
);
|
||||
|
||||
return alternative_qos_profile_local_var;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue