mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 05:40: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_context_info_t *OpenAPI_context_info_create(
|
|||
|
||||
void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == context_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(context_info->orig_headers, node) {
|
||||
ogs_free(node->data);
|
||||
if (context_info->orig_headers) {
|
||||
OpenAPI_list_for_each(context_info->orig_headers, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(context_info->orig_headers);
|
||||
context_info->orig_headers = NULL;
|
||||
}
|
||||
OpenAPI_list_free(context_info->orig_headers);
|
||||
ogs_free(context_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (context_info == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [ContextInfo]");
|
||||
|
|
@ -40,19 +45,17 @@ cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info)
|
|||
|
||||
item = cJSON_CreateObject();
|
||||
if (context_info->orig_headers) {
|
||||
cJSON *orig_headers = cJSON_AddArrayToObject(item, "origHeaders");
|
||||
if (orig_headers == NULL) {
|
||||
cJSON *orig_headersList = cJSON_AddArrayToObject(item, "origHeaders");
|
||||
if (orig_headersList == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *orig_headers_node;
|
||||
OpenAPI_list_for_each(context_info->orig_headers, orig_headers_node) {
|
||||
if (cJSON_AddStringToObject(orig_headers, "", (char*)orig_headers_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(context_info->orig_headers, node) {
|
||||
if (cJSON_AddStringToObject(orig_headersList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
@ -62,24 +65,28 @@ end:
|
|||
OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJSON)
|
||||
{
|
||||
OpenAPI_context_info_t *context_info_local_var = NULL;
|
||||
cJSON *orig_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "origHeaders");
|
||||
|
||||
OpenAPI_list_t *orig_headersList;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *orig_headers = NULL;
|
||||
OpenAPI_list_t *orig_headersList = NULL;
|
||||
orig_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "origHeaders");
|
||||
if (orig_headers) {
|
||||
cJSON *orig_headers_local;
|
||||
if (!cJSON_IsArray(orig_headers)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
orig_headersList = OpenAPI_list_create();
|
||||
cJSON *orig_headers_local = NULL;
|
||||
if (!cJSON_IsArray(orig_headers)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(orig_headers_local, orig_headers) {
|
||||
if (!cJSON_IsString(orig_headers_local)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(orig_headersList, ogs_strdup(orig_headers_local->valuestring));
|
||||
}
|
||||
orig_headersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(orig_headers_local, orig_headers) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(orig_headers_local)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [orig_headers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(orig_headersList, ogs_strdup(orig_headers_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
context_info_local_var = OpenAPI_context_info_create (
|
||||
|
|
@ -88,6 +95,13 @@ OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJS
|
|||
|
||||
return context_info_local_var;
|
||||
end:
|
||||
if (orig_headersList) {
|
||||
OpenAPI_list_for_each(orig_headersList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(orig_headersList);
|
||||
orig_headersList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue