mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 13:50: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
|
|
@ -20,18 +20,26 @@ OpenAPI_point_t *OpenAPI_point_create(
|
|||
|
||||
void OpenAPI_point_free(OpenAPI_point_t *point)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == point) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_supported_gad_shapes_free(point->shape);
|
||||
OpenAPI_geographical_coordinates_free(point->point);
|
||||
if (point->shape) {
|
||||
OpenAPI_supported_gad_shapes_free(point->shape);
|
||||
point->shape = NULL;
|
||||
}
|
||||
if (point->point) {
|
||||
OpenAPI_geographical_coordinates_free(point->point);
|
||||
point->point = NULL;
|
||||
}
|
||||
ogs_free(point);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_point_convertToJSON(OpenAPI_point_t *point)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (point == NULL) {
|
||||
ogs_error("OpenAPI_point_convertToJSON() failed [Point]");
|
||||
|
|
@ -39,6 +47,10 @@ cJSON *OpenAPI_point_convertToJSON(OpenAPI_point_t *point)
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!point->shape) {
|
||||
ogs_error("OpenAPI_point_convertToJSON() failed [shape]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *shape_local_JSON = OpenAPI_supported_gad_shapes_convertToJSON(point->shape);
|
||||
if (shape_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_point_convertToJSON() failed [shape]");
|
||||
|
|
@ -50,6 +62,10 @@ cJSON *OpenAPI_point_convertToJSON(OpenAPI_point_t *point)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (!point->point) {
|
||||
ogs_error("OpenAPI_point_convertToJSON() failed [point]");
|
||||
return NULL;
|
||||
}
|
||||
cJSON *point_local_JSON = OpenAPI_geographical_coordinates_convertToJSON(point->point);
|
||||
if (point_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_point_convertToJSON() failed [point]");
|
||||
|
|
@ -68,22 +84,23 @@ end:
|
|||
OpenAPI_point_t *OpenAPI_point_parseFromJSON(cJSON *pointJSON)
|
||||
{
|
||||
OpenAPI_point_t *point_local_var = NULL;
|
||||
cJSON *shape = cJSON_GetObjectItemCaseSensitive(pointJSON, "shape");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *shape = NULL;
|
||||
OpenAPI_supported_gad_shapes_t *shape_local_nonprim = NULL;
|
||||
cJSON *point = NULL;
|
||||
OpenAPI_geographical_coordinates_t *point_local_nonprim = NULL;
|
||||
shape = cJSON_GetObjectItemCaseSensitive(pointJSON, "shape");
|
||||
if (!shape) {
|
||||
ogs_error("OpenAPI_point_parseFromJSON() failed [shape]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_supported_gad_shapes_t *shape_local_nonprim = NULL;
|
||||
shape_local_nonprim = OpenAPI_supported_gad_shapes_parseFromJSON(shape);
|
||||
|
||||
cJSON *point = cJSON_GetObjectItemCaseSensitive(pointJSON, "point");
|
||||
point = cJSON_GetObjectItemCaseSensitive(pointJSON, "point");
|
||||
if (!point) {
|
||||
ogs_error("OpenAPI_point_parseFromJSON() failed [point]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_geographical_coordinates_t *point_local_nonprim = NULL;
|
||||
point_local_nonprim = OpenAPI_geographical_coordinates_parseFromJSON(point);
|
||||
|
||||
point_local_var = OpenAPI_point_create (
|
||||
|
|
@ -93,6 +110,14 @@ OpenAPI_point_t *OpenAPI_point_parseFromJSON(cJSON *pointJSON)
|
|||
|
||||
return point_local_var;
|
||||
end:
|
||||
if (shape_local_nonprim) {
|
||||
OpenAPI_supported_gad_shapes_free(shape_local_nonprim);
|
||||
shape_local_nonprim = NULL;
|
||||
}
|
||||
if (point_local_nonprim) {
|
||||
OpenAPI_geographical_coordinates_free(point_local_nonprim);
|
||||
point_local_nonprim = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue