mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 15:24:14 +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
|
|
@ -49,32 +49,46 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create(
|
|||
|
||||
void OpenAPI_nwdaf_cond_free(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == nwdaf_cond) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(nwdaf_cond->analytics_ids, node) {
|
||||
ogs_free(node->data);
|
||||
if (nwdaf_cond->analytics_ids) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->analytics_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->analytics_ids);
|
||||
nwdaf_cond->analytics_ids = NULL;
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->analytics_ids);
|
||||
OpenAPI_list_for_each(nwdaf_cond->snssai_list, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
if (nwdaf_cond->snssai_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->snssai_list, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->snssai_list);
|
||||
nwdaf_cond->snssai_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->snssai_list);
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
if (nwdaf_cond->tai_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_list, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->tai_list);
|
||||
nwdaf_cond->tai_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->tai_list);
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_range_list, node) {
|
||||
OpenAPI_tai_range_free(node->data);
|
||||
if (nwdaf_cond->tai_range_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_range_list, node) {
|
||||
OpenAPI_tai_range_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->tai_range_list);
|
||||
nwdaf_cond->tai_range_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(nwdaf_cond->tai_range_list);
|
||||
ogs_free(nwdaf_cond);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (nwdaf_cond == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [NwdafCond]");
|
||||
|
|
@ -82,25 +96,27 @@ cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (nwdaf_cond->condition_type == OpenAPI_nwdaf_cond_CONDITIONTYPE_NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [condition_type]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "conditionType", OpenAPI_condition_typenwdaf_cond_ToString(nwdaf_cond->condition_type)) == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [condition_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (nwdaf_cond->analytics_ids) {
|
||||
cJSON *analytics_ids = cJSON_AddArrayToObject(item, "analyticsIds");
|
||||
if (analytics_ids == NULL) {
|
||||
cJSON *analytics_idsList = cJSON_AddArrayToObject(item, "analyticsIds");
|
||||
if (analytics_idsList == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *analytics_ids_node;
|
||||
OpenAPI_list_for_each(nwdaf_cond->analytics_ids, analytics_ids_node) {
|
||||
if (cJSON_AddStringToObject(analytics_ids, "", (char*)analytics_ids_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(nwdaf_cond->analytics_ids, node) {
|
||||
if (cJSON_AddStringToObject(analytics_idsList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nwdaf_cond->snssai_list) {
|
||||
|
|
@ -109,17 +125,13 @@ cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
|||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *snssai_list_node;
|
||||
if (nwdaf_cond->snssai_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->snssai_list, snssai_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(snssai_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(snssai_listList, itemLocal);
|
||||
OpenAPI_list_for_each(nwdaf_cond->snssai_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(snssai_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,17 +141,13 @@ cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
|||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *tai_list_node;
|
||||
if (nwdaf_cond->tai_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_list, tai_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_convertToJSON(tai_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_listList, itemLocal);
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,17 +157,13 @@ cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond)
|
|||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *tai_range_list_node;
|
||||
if (nwdaf_cond->tai_range_list) {
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_range_list, tai_range_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(tai_range_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_range_listList, itemLocal);
|
||||
OpenAPI_list_for_each(nwdaf_cond->tai_range_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(tai_range_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -170,124 +174,122 @@ end:
|
|||
OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON)
|
||||
{
|
||||
OpenAPI_nwdaf_cond_t *nwdaf_cond_local_var = NULL;
|
||||
cJSON *condition_type = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "conditionType");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *condition_type = NULL;
|
||||
OpenAPI_nwdaf_cond_condition_type_e condition_typeVariable = 0;
|
||||
cJSON *analytics_ids = NULL;
|
||||
OpenAPI_list_t *analytics_idsList = NULL;
|
||||
cJSON *snssai_list = NULL;
|
||||
OpenAPI_list_t *snssai_listList = NULL;
|
||||
cJSON *tai_list = NULL;
|
||||
OpenAPI_list_t *tai_listList = NULL;
|
||||
cJSON *tai_range_list = NULL;
|
||||
OpenAPI_list_t *tai_range_listList = NULL;
|
||||
condition_type = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "conditionType");
|
||||
if (!condition_type) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [condition_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_nwdaf_cond_condition_type_e condition_typeVariable;
|
||||
if (!cJSON_IsString(condition_type)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [condition_type]");
|
||||
goto end;
|
||||
}
|
||||
condition_typeVariable = OpenAPI_condition_typenwdaf_cond_FromString(condition_type->valuestring);
|
||||
|
||||
cJSON *analytics_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "analyticsIds");
|
||||
|
||||
OpenAPI_list_t *analytics_idsList;
|
||||
analytics_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "analyticsIds");
|
||||
if (analytics_ids) {
|
||||
cJSON *analytics_ids_local;
|
||||
if (!cJSON_IsArray(analytics_ids)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
analytics_idsList = OpenAPI_list_create();
|
||||
cJSON *analytics_ids_local = NULL;
|
||||
if (!cJSON_IsArray(analytics_ids)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(analytics_ids_local, analytics_ids) {
|
||||
if (!cJSON_IsString(analytics_ids_local)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(analytics_idsList, ogs_strdup(analytics_ids_local->valuestring));
|
||||
}
|
||||
analytics_idsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(analytics_ids_local, analytics_ids) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(analytics_ids_local)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [analytics_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(analytics_idsList, ogs_strdup(analytics_ids_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *snssai_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "snssaiList");
|
||||
|
||||
OpenAPI_list_t *snssai_listList;
|
||||
snssai_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "snssaiList");
|
||||
if (snssai_list) {
|
||||
cJSON *snssai_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(snssai_list)){
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
snssai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(snssai_list_local_nonprimitive, snssai_list ) {
|
||||
if (!cJSON_IsObject(snssai_list_local_nonprimitive)) {
|
||||
cJSON *snssai_list_local = NULL;
|
||||
if (!cJSON_IsArray(snssai_list)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local_nonprimitive);
|
||||
|
||||
if (!snssai_listItem) {
|
||||
ogs_error("No snssai_listItem");
|
||||
OpenAPI_list_free(snssai_listList);
|
||||
goto end;
|
||||
snssai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(snssai_list_local, snssai_list) {
|
||||
if (!cJSON_IsObject(snssai_list_local)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [snssai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local);
|
||||
if (!snssai_listItem) {
|
||||
ogs_error("No snssai_listItem");
|
||||
OpenAPI_list_free(snssai_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(snssai_listList, snssai_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(snssai_listList, snssai_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *tai_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "taiList");
|
||||
|
||||
OpenAPI_list_t *tai_listList;
|
||||
tai_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "taiList");
|
||||
if (tai_list) {
|
||||
cJSON *tai_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(tai_list)){
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
tai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_list_local_nonprimitive, tai_list ) {
|
||||
if (!cJSON_IsObject(tai_list_local_nonprimitive)) {
|
||||
cJSON *tai_list_local = NULL;
|
||||
if (!cJSON_IsArray(tai_list)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local_nonprimitive);
|
||||
|
||||
if (!tai_listItem) {
|
||||
ogs_error("No tai_listItem");
|
||||
OpenAPI_list_free(tai_listList);
|
||||
goto end;
|
||||
tai_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_list_local, tai_list) {
|
||||
if (!cJSON_IsObject(tai_list_local)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local);
|
||||
if (!tai_listItem) {
|
||||
ogs_error("No tai_listItem");
|
||||
OpenAPI_list_free(tai_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(tai_listList, tai_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(tai_listList, tai_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *tai_range_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "taiRangeList");
|
||||
|
||||
OpenAPI_list_t *tai_range_listList;
|
||||
tai_range_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "taiRangeList");
|
||||
if (tai_range_list) {
|
||||
cJSON *tai_range_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(tai_range_list)){
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
tai_range_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_range_list_local_nonprimitive, tai_range_list ) {
|
||||
if (!cJSON_IsObject(tai_range_list_local_nonprimitive)) {
|
||||
cJSON *tai_range_list_local = NULL;
|
||||
if (!cJSON_IsArray(tai_range_list)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local_nonprimitive);
|
||||
|
||||
if (!tai_range_listItem) {
|
||||
ogs_error("No tai_range_listItem");
|
||||
OpenAPI_list_free(tai_range_listList);
|
||||
goto end;
|
||||
tai_range_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(tai_range_list_local, tai_range_list) {
|
||||
if (!cJSON_IsObject(tai_range_list_local)) {
|
||||
ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [tai_range_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local);
|
||||
if (!tai_range_listItem) {
|
||||
ogs_error("No tai_range_listItem");
|
||||
OpenAPI_list_free(tai_range_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(tai_range_listList, tai_range_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(tai_range_listList, tai_range_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
nwdaf_cond_local_var = OpenAPI_nwdaf_cond_create (
|
||||
|
|
@ -300,6 +302,34 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON)
|
|||
|
||||
return nwdaf_cond_local_var;
|
||||
end:
|
||||
if (analytics_idsList) {
|
||||
OpenAPI_list_for_each(analytics_idsList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(analytics_idsList);
|
||||
analytics_idsList = NULL;
|
||||
}
|
||||
if (snssai_listList) {
|
||||
OpenAPI_list_for_each(snssai_listList, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(snssai_listList);
|
||||
snssai_listList = NULL;
|
||||
}
|
||||
if (tai_listList) {
|
||||
OpenAPI_list_for_each(tai_listList, node) {
|
||||
OpenAPI_tai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(tai_listList);
|
||||
tai_listList = NULL;
|
||||
}
|
||||
if (tai_range_listList) {
|
||||
OpenAPI_list_for_each(tai_range_listList, node) {
|
||||
OpenAPI_tai_range_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(tai_range_listList);
|
||||
tai_range_listList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue