[SBI] Crash occurs when ENUM in the MAP (#2103)

This commit is contained in:
Sukchan Lee 2023-03-01 17:50:25 +09:00
parent ce668c556c
commit 969c116e77
1097 changed files with 266728 additions and 42047 deletions

View file

@ -20,18 +20,26 @@ OpenAPI_ambr_1_t *OpenAPI_ambr_1_create(
void OpenAPI_ambr_1_free(OpenAPI_ambr_1_t *ambr_1)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == ambr_1) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(ambr_1->uplink);
ogs_free(ambr_1->downlink);
if (ambr_1->uplink) {
ogs_free(ambr_1->uplink);
ambr_1->uplink = NULL;
}
if (ambr_1->downlink) {
ogs_free(ambr_1->downlink);
ambr_1->downlink = NULL;
}
ogs_free(ambr_1);
}
cJSON *OpenAPI_ambr_1_convertToJSON(OpenAPI_ambr_1_t *ambr_1)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (ambr_1 == NULL) {
ogs_error("OpenAPI_ambr_1_convertToJSON() failed [Ambr_1]");
@ -39,11 +47,19 @@ cJSON *OpenAPI_ambr_1_convertToJSON(OpenAPI_ambr_1_t *ambr_1)
}
item = cJSON_CreateObject();
if (!ambr_1->uplink) {
ogs_error("OpenAPI_ambr_1_convertToJSON() failed [uplink]");
return NULL;
}
if (cJSON_AddStringToObject(item, "uplink", ambr_1->uplink) == NULL) {
ogs_error("OpenAPI_ambr_1_convertToJSON() failed [uplink]");
goto end;
}
if (!ambr_1->downlink) {
ogs_error("OpenAPI_ambr_1_convertToJSON() failed [downlink]");
return NULL;
}
if (cJSON_AddStringToObject(item, "downlink", ambr_1->downlink) == NULL) {
ogs_error("OpenAPI_ambr_1_convertToJSON() failed [downlink]");
goto end;
@ -56,23 +72,24 @@ end:
OpenAPI_ambr_1_t *OpenAPI_ambr_1_parseFromJSON(cJSON *ambr_1JSON)
{
OpenAPI_ambr_1_t *ambr_1_local_var = NULL;
cJSON *uplink = cJSON_GetObjectItemCaseSensitive(ambr_1JSON, "uplink");
OpenAPI_lnode_t *node = NULL;
cJSON *uplink = NULL;
cJSON *downlink = NULL;
uplink = cJSON_GetObjectItemCaseSensitive(ambr_1JSON, "uplink");
if (!uplink) {
ogs_error("OpenAPI_ambr_1_parseFromJSON() failed [uplink]");
goto end;
}
if (!cJSON_IsString(uplink)) {
ogs_error("OpenAPI_ambr_1_parseFromJSON() failed [uplink]");
goto end;
}
cJSON *downlink = cJSON_GetObjectItemCaseSensitive(ambr_1JSON, "downlink");
downlink = cJSON_GetObjectItemCaseSensitive(ambr_1JSON, "downlink");
if (!downlink) {
ogs_error("OpenAPI_ambr_1_parseFromJSON() failed [downlink]");
goto end;
}
if (!cJSON_IsString(downlink)) {
ogs_error("OpenAPI_ambr_1_parseFromJSON() failed [downlink]");
goto end;