mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 13:20:08 +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
|
|
@ -26,25 +26,36 @@ OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_create(
|
|||
|
||||
void OpenAPI_default_unrelated_class_free(OpenAPI_default_unrelated_class_t *default_unrelated_class)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == default_unrelated_class) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
if (default_unrelated_class->allowed_geographic_area) {
|
||||
OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(default_unrelated_class->allowed_geographic_area);
|
||||
default_unrelated_class->allowed_geographic_area = NULL;
|
||||
}
|
||||
OpenAPI_list_free(default_unrelated_class->allowed_geographic_area);
|
||||
OpenAPI_valid_time_period_free(default_unrelated_class->valid_time_period);
|
||||
OpenAPI_list_for_each(default_unrelated_class->code_word_list, node) {
|
||||
ogs_free(node->data);
|
||||
if (default_unrelated_class->valid_time_period) {
|
||||
OpenAPI_valid_time_period_free(default_unrelated_class->valid_time_period);
|
||||
default_unrelated_class->valid_time_period = NULL;
|
||||
}
|
||||
if (default_unrelated_class->code_word_list) {
|
||||
OpenAPI_list_for_each(default_unrelated_class->code_word_list, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(default_unrelated_class->code_word_list);
|
||||
default_unrelated_class->code_word_list = NULL;
|
||||
}
|
||||
OpenAPI_list_free(default_unrelated_class->code_word_list);
|
||||
ogs_free(default_unrelated_class);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_default_unrelated_class_convertToJSON(OpenAPI_default_unrelated_class_t *default_unrelated_class)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (default_unrelated_class == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [DefaultUnrelatedClass]");
|
||||
|
|
@ -58,28 +69,24 @@ cJSON *OpenAPI_default_unrelated_class_convertToJSON(OpenAPI_default_unrelated_c
|
|||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *allowed_geographic_area_node;
|
||||
if (default_unrelated_class->allowed_geographic_area) {
|
||||
OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, allowed_geographic_area_node) {
|
||||
cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(allowed_geographic_area_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal);
|
||||
OpenAPI_list_for_each(default_unrelated_class->allowed_geographic_area, node) {
|
||||
cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
if (default_unrelated_class->privacy_check_related_action) {
|
||||
if (default_unrelated_class->privacy_check_related_action != OpenAPI_privacy_check_related_action_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(default_unrelated_class->privacy_check_related_action)) == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [privacy_check_related_action]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (default_unrelated_class->code_word_ind) {
|
||||
if (default_unrelated_class->code_word_ind != OpenAPI_code_word_ind_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(default_unrelated_class->code_word_ind)) == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_ind]");
|
||||
goto end;
|
||||
|
|
@ -100,19 +107,17 @@ cJSON *OpenAPI_default_unrelated_class_convertToJSON(OpenAPI_default_unrelated_c
|
|||
}
|
||||
|
||||
if (default_unrelated_class->code_word_list) {
|
||||
cJSON *code_word_list = cJSON_AddArrayToObject(item, "codeWordList");
|
||||
if (code_word_list == NULL) {
|
||||
cJSON *code_word_listList = cJSON_AddArrayToObject(item, "codeWordList");
|
||||
if (code_word_listList == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *code_word_list_node;
|
||||
OpenAPI_list_for_each(default_unrelated_class->code_word_list, code_word_list_node) {
|
||||
if (cJSON_AddStringToObject(code_word_list, "", (char*)code_word_list_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(default_unrelated_class->code_word_list, node) {
|
||||
if (cJSON_AddStringToObject(code_word_listList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_convertToJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -122,38 +127,43 @@ end:
|
|||
OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON(cJSON *default_unrelated_classJSON)
|
||||
{
|
||||
OpenAPI_default_unrelated_class_t *default_unrelated_class_local_var = NULL;
|
||||
cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "allowedGeographicArea");
|
||||
|
||||
OpenAPI_list_t *allowed_geographic_areaList;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *allowed_geographic_area = NULL;
|
||||
OpenAPI_list_t *allowed_geographic_areaList = NULL;
|
||||
cJSON *privacy_check_related_action = NULL;
|
||||
OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable = 0;
|
||||
cJSON *code_word_ind = NULL;
|
||||
OpenAPI_code_word_ind_e code_word_indVariable = 0;
|
||||
cJSON *valid_time_period = NULL;
|
||||
OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL;
|
||||
cJSON *code_word_list = NULL;
|
||||
OpenAPI_list_t *code_word_listList = NULL;
|
||||
allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "allowedGeographicArea");
|
||||
if (allowed_geographic_area) {
|
||||
cJSON *allowed_geographic_area_local_nonprimitive;
|
||||
if (!cJSON_IsArray(allowed_geographic_area)){
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
allowed_geographic_areaList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(allowed_geographic_area_local_nonprimitive, allowed_geographic_area ) {
|
||||
if (!cJSON_IsObject(allowed_geographic_area_local_nonprimitive)) {
|
||||
cJSON *allowed_geographic_area_local = NULL;
|
||||
if (!cJSON_IsArray(allowed_geographic_area)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local_nonprimitive);
|
||||
|
||||
if (!allowed_geographic_areaItem) {
|
||||
ogs_error("No allowed_geographic_areaItem");
|
||||
OpenAPI_list_free(allowed_geographic_areaList);
|
||||
goto end;
|
||||
allowed_geographic_areaList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(allowed_geographic_area_local, allowed_geographic_area) {
|
||||
if (!cJSON_IsObject(allowed_geographic_area_local)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [allowed_geographic_area]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local);
|
||||
if (!allowed_geographic_areaItem) {
|
||||
ogs_error("No allowed_geographic_areaItem");
|
||||
OpenAPI_list_free(allowed_geographic_areaList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "privacyCheckRelatedAction");
|
||||
|
||||
OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable;
|
||||
privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "privacyCheckRelatedAction");
|
||||
if (privacy_check_related_action) {
|
||||
if (!cJSON_IsString(privacy_check_related_action)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [privacy_check_related_action]");
|
||||
|
|
@ -162,9 +172,7 @@ OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON
|
|||
privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring);
|
||||
}
|
||||
|
||||
cJSON *code_word_ind = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordInd");
|
||||
|
||||
OpenAPI_code_word_ind_e code_word_indVariable;
|
||||
code_word_ind = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordInd");
|
||||
if (code_word_ind) {
|
||||
if (!cJSON_IsString(code_word_ind)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_ind]");
|
||||
|
|
@ -173,31 +181,30 @@ OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON
|
|||
code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring);
|
||||
}
|
||||
|
||||
cJSON *valid_time_period = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "validTimePeriod");
|
||||
|
||||
OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL;
|
||||
valid_time_period = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "validTimePeriod");
|
||||
if (valid_time_period) {
|
||||
valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period);
|
||||
}
|
||||
|
||||
cJSON *code_word_list = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordList");
|
||||
|
||||
OpenAPI_list_t *code_word_listList;
|
||||
code_word_list = cJSON_GetObjectItemCaseSensitive(default_unrelated_classJSON, "codeWordList");
|
||||
if (code_word_list) {
|
||||
cJSON *code_word_list_local;
|
||||
if (!cJSON_IsArray(code_word_list)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
code_word_listList = OpenAPI_list_create();
|
||||
cJSON *code_word_list_local = NULL;
|
||||
if (!cJSON_IsArray(code_word_list)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(code_word_list_local, code_word_list) {
|
||||
if (!cJSON_IsString(code_word_list_local)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring));
|
||||
}
|
||||
code_word_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(code_word_list_local, code_word_list) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(code_word_list_local)) {
|
||||
ogs_error("OpenAPI_default_unrelated_class_parseFromJSON() failed [code_word_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
default_unrelated_class_local_var = OpenAPI_default_unrelated_class_create (
|
||||
|
|
@ -210,6 +217,24 @@ OpenAPI_default_unrelated_class_t *OpenAPI_default_unrelated_class_parseFromJSON
|
|||
|
||||
return default_unrelated_class_local_var;
|
||||
end:
|
||||
if (allowed_geographic_areaList) {
|
||||
OpenAPI_list_for_each(allowed_geographic_areaList, node) {
|
||||
OpenAPI_geographic_area_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(allowed_geographic_areaList);
|
||||
allowed_geographic_areaList = NULL;
|
||||
}
|
||||
if (valid_time_period_local_nonprim) {
|
||||
OpenAPI_valid_time_period_free(valid_time_period_local_nonprim);
|
||||
valid_time_period_local_nonprim = NULL;
|
||||
}
|
||||
if (code_word_listList) {
|
||||
OpenAPI_list_for_each(code_word_listList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(code_word_listList);
|
||||
code_word_listList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue