mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 05:10:10 +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
|
|
@ -20,21 +20,29 @@ OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_create(
|
|||
|
||||
void OpenAPI_usage_mon_data_scope_free(OpenAPI_usage_mon_data_scope_t *usage_mon_data_scope)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == usage_mon_data_scope) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_snssai_free(usage_mon_data_scope->snssai);
|
||||
OpenAPI_list_for_each(usage_mon_data_scope->dnn, node) {
|
||||
ogs_free(node->data);
|
||||
if (usage_mon_data_scope->snssai) {
|
||||
OpenAPI_snssai_free(usage_mon_data_scope->snssai);
|
||||
usage_mon_data_scope->snssai = NULL;
|
||||
}
|
||||
if (usage_mon_data_scope->dnn) {
|
||||
OpenAPI_list_for_each(usage_mon_data_scope->dnn, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(usage_mon_data_scope->dnn);
|
||||
usage_mon_data_scope->dnn = NULL;
|
||||
}
|
||||
OpenAPI_list_free(usage_mon_data_scope->dnn);
|
||||
ogs_free(usage_mon_data_scope);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_usage_mon_data_scope_convertToJSON(OpenAPI_usage_mon_data_scope_t *usage_mon_data_scope)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (usage_mon_data_scope == NULL) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [UsageMonDataScope]");
|
||||
|
|
@ -42,6 +50,10 @@ cJSON *OpenAPI_usage_mon_data_scope_convertToJSON(OpenAPI_usage_mon_data_scope_t
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!usage_mon_data_scope->snssai) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [snssai]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(usage_mon_data_scope->snssai);
|
||||
if (snssai_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [snssai]");
|
||||
|
|
@ -54,19 +66,17 @@ cJSON *OpenAPI_usage_mon_data_scope_convertToJSON(OpenAPI_usage_mon_data_scope_t
|
|||
}
|
||||
|
||||
if (usage_mon_data_scope->dnn) {
|
||||
cJSON *dnn = cJSON_AddArrayToObject(item, "dnn");
|
||||
if (dnn == NULL) {
|
||||
cJSON *dnnList = cJSON_AddArrayToObject(item, "dnn");
|
||||
if (dnnList == NULL) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *dnn_node;
|
||||
OpenAPI_list_for_each(usage_mon_data_scope->dnn, dnn_node) {
|
||||
if (cJSON_AddStringToObject(dnn, "", (char*)dnn_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [dnn]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(usage_mon_data_scope->dnn, node) {
|
||||
if (cJSON_AddStringToObject(dnnList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_convertToJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -76,33 +86,37 @@ end:
|
|||
OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_parseFromJSON(cJSON *usage_mon_data_scopeJSON)
|
||||
{
|
||||
OpenAPI_usage_mon_data_scope_t *usage_mon_data_scope_local_var = NULL;
|
||||
cJSON *snssai = cJSON_GetObjectItemCaseSensitive(usage_mon_data_scopeJSON, "snssai");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *snssai = NULL;
|
||||
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
|
||||
cJSON *dnn = NULL;
|
||||
OpenAPI_list_t *dnnList = NULL;
|
||||
snssai = cJSON_GetObjectItemCaseSensitive(usage_mon_data_scopeJSON, "snssai");
|
||||
if (!snssai) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_parseFromJSON() failed [snssai]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
|
||||
snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai);
|
||||
|
||||
cJSON *dnn = cJSON_GetObjectItemCaseSensitive(usage_mon_data_scopeJSON, "dnn");
|
||||
|
||||
OpenAPI_list_t *dnnList;
|
||||
dnn = cJSON_GetObjectItemCaseSensitive(usage_mon_data_scopeJSON, "dnn");
|
||||
if (dnn) {
|
||||
cJSON *dnn_local;
|
||||
if (!cJSON_IsArray(dnn)) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_parseFromJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
dnnList = OpenAPI_list_create();
|
||||
cJSON *dnn_local = NULL;
|
||||
if (!cJSON_IsArray(dnn)) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_parseFromJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(dnn_local, dnn) {
|
||||
if (!cJSON_IsString(dnn_local)) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_parseFromJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(dnnList, ogs_strdup(dnn_local->valuestring));
|
||||
}
|
||||
dnnList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(dnn_local, dnn) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(dnn_local)) {
|
||||
ogs_error("OpenAPI_usage_mon_data_scope_parseFromJSON() failed [dnn]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(dnnList, ogs_strdup(dnn_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
usage_mon_data_scope_local_var = OpenAPI_usage_mon_data_scope_create (
|
||||
|
|
@ -112,6 +126,17 @@ OpenAPI_usage_mon_data_scope_t *OpenAPI_usage_mon_data_scope_parseFromJSON(cJSON
|
|||
|
||||
return usage_mon_data_scope_local_var;
|
||||
end:
|
||||
if (snssai_local_nonprim) {
|
||||
OpenAPI_snssai_free(snssai_local_nonprim);
|
||||
snssai_local_nonprim = NULL;
|
||||
}
|
||||
if (dnnList) {
|
||||
OpenAPI_list_for_each(dnnList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(dnnList);
|
||||
dnnList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue