[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

@ -22,17 +22,22 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create(
void OpenAPI_subscribed_snssai_free(OpenAPI_subscribed_snssai_t *subscribed_snssai)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == subscribed_snssai) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_snssai_free(subscribed_snssai->subscribed_snssai);
if (subscribed_snssai->subscribed_snssai) {
OpenAPI_snssai_free(subscribed_snssai->subscribed_snssai);
subscribed_snssai->subscribed_snssai = NULL;
}
ogs_free(subscribed_snssai);
}
cJSON *OpenAPI_subscribed_snssai_convertToJSON(OpenAPI_subscribed_snssai_t *subscribed_snssai)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (subscribed_snssai == NULL) {
ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [SubscribedSnssai]");
@ -40,6 +45,10 @@ cJSON *OpenAPI_subscribed_snssai_convertToJSON(OpenAPI_subscribed_snssai_t *subs
}
item = cJSON_CreateObject();
if (!subscribed_snssai->subscribed_snssai) {
ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_snssai]");
return NULL;
}
cJSON *subscribed_snssai_local_JSON = OpenAPI_snssai_convertToJSON(subscribed_snssai->subscribed_snssai);
if (subscribed_snssai_local_JSON == NULL) {
ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_snssai]");
@ -65,17 +74,18 @@ end:
OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subscribed_snssaiJSON)
{
OpenAPI_subscribed_snssai_t *subscribed_snssai_local_var = NULL;
cJSON *subscribed_snssai = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "subscribedSnssai");
OpenAPI_lnode_t *node = NULL;
cJSON *subscribed_snssai = NULL;
OpenAPI_snssai_t *subscribed_snssai_local_nonprim = NULL;
cJSON *default_indication = NULL;
subscribed_snssai = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "subscribedSnssai");
if (!subscribed_snssai) {
ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [subscribed_snssai]");
goto end;
}
OpenAPI_snssai_t *subscribed_snssai_local_nonprim = NULL;
subscribed_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(subscribed_snssai);
cJSON *default_indication = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "defaultIndication");
default_indication = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "defaultIndication");
if (default_indication) {
if (!cJSON_IsBool(default_indication)) {
ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [default_indication]");
@ -91,6 +101,10 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subs
return subscribed_snssai_local_var;
end:
if (subscribed_snssai_local_nonprim) {
OpenAPI_snssai_free(subscribed_snssai_local_nonprim);
subscribed_snssai_local_nonprim = NULL;
}
return NULL;
}