mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +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
|
|
@ -18,20 +18,25 @@ OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_create(
|
|||
|
||||
void OpenAPI_sponsor_connectivity_data_free(OpenAPI_sponsor_connectivity_data_t *sponsor_connectivity_data)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == sponsor_connectivity_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(sponsor_connectivity_data->asp_ids, node) {
|
||||
ogs_free(node->data);
|
||||
if (sponsor_connectivity_data->asp_ids) {
|
||||
OpenAPI_list_for_each(sponsor_connectivity_data->asp_ids, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(sponsor_connectivity_data->asp_ids);
|
||||
sponsor_connectivity_data->asp_ids = NULL;
|
||||
}
|
||||
OpenAPI_list_free(sponsor_connectivity_data->asp_ids);
|
||||
ogs_free(sponsor_connectivity_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_sponsor_connectivity_data_convertToJSON(OpenAPI_sponsor_connectivity_data_t *sponsor_connectivity_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (sponsor_connectivity_data == NULL) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_convertToJSON() failed [SponsorConnectivityData]");
|
||||
|
|
@ -39,19 +44,21 @@ cJSON *OpenAPI_sponsor_connectivity_data_convertToJSON(OpenAPI_sponsor_connectiv
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
cJSON *asp_ids = cJSON_AddArrayToObject(item, "aspIds");
|
||||
if (asp_ids == NULL) {
|
||||
if (!sponsor_connectivity_data->asp_ids) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_convertToJSON() failed [asp_ids]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *asp_idsList = cJSON_AddArrayToObject(item, "aspIds");
|
||||
if (asp_idsList == NULL) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_convertToJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *asp_ids_node;
|
||||
OpenAPI_list_for_each(sponsor_connectivity_data->asp_ids, asp_ids_node) {
|
||||
if (cJSON_AddStringToObject(asp_ids, "", (char*)asp_ids_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_convertToJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(sponsor_connectivity_data->asp_ids, node) {
|
||||
if (cJSON_AddStringToObject(asp_idsList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_convertToJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
|
|
@ -60,27 +67,31 @@ end:
|
|||
OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_parseFromJSON(cJSON *sponsor_connectivity_dataJSON)
|
||||
{
|
||||
OpenAPI_sponsor_connectivity_data_t *sponsor_connectivity_data_local_var = NULL;
|
||||
cJSON *asp_ids = cJSON_GetObjectItemCaseSensitive(sponsor_connectivity_dataJSON, "aspIds");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *asp_ids = NULL;
|
||||
OpenAPI_list_t *asp_idsList = NULL;
|
||||
asp_ids = cJSON_GetObjectItemCaseSensitive(sponsor_connectivity_dataJSON, "aspIds");
|
||||
if (!asp_ids) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_parseFromJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *asp_ids_local = NULL;
|
||||
if (!cJSON_IsArray(asp_ids)) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_parseFromJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_t *asp_idsList;
|
||||
cJSON *asp_ids_local;
|
||||
if (!cJSON_IsArray(asp_ids)) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_parseFromJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
asp_idsList = OpenAPI_list_create();
|
||||
asp_idsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(asp_ids_local, asp_ids) {
|
||||
if (!cJSON_IsString(asp_ids_local)) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_parseFromJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(asp_idsList, ogs_strdup(asp_ids_local->valuestring));
|
||||
}
|
||||
cJSON_ArrayForEach(asp_ids_local, asp_ids) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(asp_ids_local)) {
|
||||
ogs_error("OpenAPI_sponsor_connectivity_data_parseFromJSON() failed [asp_ids]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(asp_idsList, ogs_strdup(asp_ids_local->valuestring));
|
||||
}
|
||||
|
||||
sponsor_connectivity_data_local_var = OpenAPI_sponsor_connectivity_data_create (
|
||||
asp_idsList
|
||||
|
|
@ -88,6 +99,13 @@ OpenAPI_sponsor_connectivity_data_t *OpenAPI_sponsor_connectivity_data_parseFrom
|
|||
|
||||
return sponsor_connectivity_data_local_var;
|
||||
end:
|
||||
if (asp_idsList) {
|
||||
OpenAPI_list_for_each(asp_idsList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(asp_idsList);
|
||||
asp_idsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue