mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 14:20: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
|
|
@ -5,7 +5,7 @@
|
|||
#include "ue_policy_section.h"
|
||||
|
||||
OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_create(
|
||||
char ue_policy_section_info,
|
||||
char *ue_policy_section_info,
|
||||
char *upsi
|
||||
)
|
||||
{
|
||||
|
|
@ -20,17 +20,26 @@ OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_create(
|
|||
|
||||
void OpenAPI_ue_policy_section_free(OpenAPI_ue_policy_section_t *ue_policy_section)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == ue_policy_section) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ue_policy_section->upsi);
|
||||
if (ue_policy_section->ue_policy_section_info) {
|
||||
ogs_free(ue_policy_section->ue_policy_section_info);
|
||||
ue_policy_section->ue_policy_section_info = NULL;
|
||||
}
|
||||
if (ue_policy_section->upsi) {
|
||||
ogs_free(ue_policy_section->upsi);
|
||||
ue_policy_section->upsi = NULL;
|
||||
}
|
||||
ogs_free(ue_policy_section);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_ue_policy_section_convertToJSON(OpenAPI_ue_policy_section_t *ue_policy_section)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (ue_policy_section == NULL) {
|
||||
ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed [UePolicySection]");
|
||||
|
|
@ -38,11 +47,19 @@ cJSON *OpenAPI_ue_policy_section_convertToJSON(OpenAPI_ue_policy_section_t *ue_p
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (cJSON_AddNumberToObject(item, "uePolicySectionInfo", ue_policy_section->ue_policy_section_info) == NULL) {
|
||||
if (!ue_policy_section->ue_policy_section_info) {
|
||||
ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed [ue_policy_section_info]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "uePolicySectionInfo", ue_policy_section->ue_policy_section_info) == NULL) {
|
||||
ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed [ue_policy_section_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!ue_policy_section->upsi) {
|
||||
ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed [upsi]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "upsi", ue_policy_section->upsi) == NULL) {
|
||||
ogs_error("OpenAPI_ue_policy_section_convertToJSON() failed [upsi]");
|
||||
goto end;
|
||||
|
|
@ -55,30 +72,31 @@ end:
|
|||
OpenAPI_ue_policy_section_t *OpenAPI_ue_policy_section_parseFromJSON(cJSON *ue_policy_sectionJSON)
|
||||
{
|
||||
OpenAPI_ue_policy_section_t *ue_policy_section_local_var = NULL;
|
||||
cJSON *ue_policy_section_info = cJSON_GetObjectItemCaseSensitive(ue_policy_sectionJSON, "uePolicySectionInfo");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *ue_policy_section_info = NULL;
|
||||
cJSON *upsi = NULL;
|
||||
ue_policy_section_info = cJSON_GetObjectItemCaseSensitive(ue_policy_sectionJSON, "uePolicySectionInfo");
|
||||
if (!ue_policy_section_info) {
|
||||
ogs_error("OpenAPI_ue_policy_section_parseFromJSON() failed [ue_policy_section_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsNumber(ue_policy_section_info)) {
|
||||
if (!cJSON_IsString(ue_policy_section_info)) {
|
||||
ogs_error("OpenAPI_ue_policy_section_parseFromJSON() failed [ue_policy_section_info]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *upsi = cJSON_GetObjectItemCaseSensitive(ue_policy_sectionJSON, "upsi");
|
||||
upsi = cJSON_GetObjectItemCaseSensitive(ue_policy_sectionJSON, "upsi");
|
||||
if (!upsi) {
|
||||
ogs_error("OpenAPI_ue_policy_section_parseFromJSON() failed [upsi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(upsi)) {
|
||||
ogs_error("OpenAPI_ue_policy_section_parseFromJSON() failed [upsi]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ue_policy_section_local_var = OpenAPI_ue_policy_section_create (
|
||||
ue_policy_section_info->valueint,
|
||||
ogs_strdup(ue_policy_section_info->valuestring),
|
||||
ogs_strdup(upsi->valuestring)
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue