[SBI] Crash occurs when ENUM in the MAP (#2103)

This commit is contained in:
Sukchan Lee 2023-03-01 17:50:25 +09:00
parent ce668c556c
commit 969c116e77
1097 changed files with 266728 additions and 42047 deletions

View file

@ -24,19 +24,30 @@ OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_create(
void OpenAPI_point_uncertainty_ellipse_free(OpenAPI_point_uncertainty_ellipse_t *point_uncertainty_ellipse)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == point_uncertainty_ellipse) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_supported_gad_shapes_free(point_uncertainty_ellipse->shape);
OpenAPI_geographical_coordinates_free(point_uncertainty_ellipse->point);
OpenAPI_uncertainty_ellipse_free(point_uncertainty_ellipse->uncertainty_ellipse);
if (point_uncertainty_ellipse->shape) {
OpenAPI_supported_gad_shapes_free(point_uncertainty_ellipse->shape);
point_uncertainty_ellipse->shape = NULL;
}
if (point_uncertainty_ellipse->point) {
OpenAPI_geographical_coordinates_free(point_uncertainty_ellipse->point);
point_uncertainty_ellipse->point = NULL;
}
if (point_uncertainty_ellipse->uncertainty_ellipse) {
OpenAPI_uncertainty_ellipse_free(point_uncertainty_ellipse->uncertainty_ellipse);
point_uncertainty_ellipse->uncertainty_ellipse = NULL;
}
ogs_free(point_uncertainty_ellipse);
}
cJSON *OpenAPI_point_uncertainty_ellipse_convertToJSON(OpenAPI_point_uncertainty_ellipse_t *point_uncertainty_ellipse)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (point_uncertainty_ellipse == NULL) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [PointUncertaintyEllipse]");
@ -44,6 +55,10 @@ cJSON *OpenAPI_point_uncertainty_ellipse_convertToJSON(OpenAPI_point_uncertainty
}
item = cJSON_CreateObject();
if (!point_uncertainty_ellipse->shape) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [shape]");
return NULL;
}
cJSON *shape_local_JSON = OpenAPI_supported_gad_shapes_convertToJSON(point_uncertainty_ellipse->shape);
if (shape_local_JSON == NULL) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [shape]");
@ -55,6 +70,10 @@ cJSON *OpenAPI_point_uncertainty_ellipse_convertToJSON(OpenAPI_point_uncertainty
goto end;
}
if (!point_uncertainty_ellipse->point) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [point]");
return NULL;
}
cJSON *point_local_JSON = OpenAPI_geographical_coordinates_convertToJSON(point_uncertainty_ellipse->point);
if (point_local_JSON == NULL) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [point]");
@ -66,6 +85,10 @@ cJSON *OpenAPI_point_uncertainty_ellipse_convertToJSON(OpenAPI_point_uncertainty
goto end;
}
if (!point_uncertainty_ellipse->uncertainty_ellipse) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [uncertainty_ellipse]");
return NULL;
}
cJSON *uncertainty_ellipse_local_JSON = OpenAPI_uncertainty_ellipse_convertToJSON(point_uncertainty_ellipse->uncertainty_ellipse);
if (uncertainty_ellipse_local_JSON == NULL) {
ogs_error("OpenAPI_point_uncertainty_ellipse_convertToJSON() failed [uncertainty_ellipse]");
@ -89,39 +112,40 @@ end:
OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_parseFromJSON(cJSON *point_uncertainty_ellipseJSON)
{
OpenAPI_point_uncertainty_ellipse_t *point_uncertainty_ellipse_local_var = NULL;
cJSON *shape = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "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;
cJSON *uncertainty_ellipse = NULL;
OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse_local_nonprim = NULL;
cJSON *confidence = NULL;
shape = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "shape");
if (!shape) {
ogs_error("OpenAPI_point_uncertainty_ellipse_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(point_uncertainty_ellipseJSON, "point");
point = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "point");
if (!point) {
ogs_error("OpenAPI_point_uncertainty_ellipse_parseFromJSON() failed [point]");
goto end;
}
OpenAPI_geographical_coordinates_t *point_local_nonprim = NULL;
point_local_nonprim = OpenAPI_geographical_coordinates_parseFromJSON(point);
cJSON *uncertainty_ellipse = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "uncertaintyEllipse");
uncertainty_ellipse = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "uncertaintyEllipse");
if (!uncertainty_ellipse) {
ogs_error("OpenAPI_point_uncertainty_ellipse_parseFromJSON() failed [uncertainty_ellipse]");
goto end;
}
OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse_local_nonprim = NULL;
uncertainty_ellipse_local_nonprim = OpenAPI_uncertainty_ellipse_parseFromJSON(uncertainty_ellipse);
cJSON *confidence = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "confidence");
confidence = cJSON_GetObjectItemCaseSensitive(point_uncertainty_ellipseJSON, "confidence");
if (!confidence) {
ogs_error("OpenAPI_point_uncertainty_ellipse_parseFromJSON() failed [confidence]");
goto end;
}
if (!cJSON_IsNumber(confidence)) {
ogs_error("OpenAPI_point_uncertainty_ellipse_parseFromJSON() failed [confidence]");
goto end;
@ -137,6 +161,18 @@ OpenAPI_point_uncertainty_ellipse_t *OpenAPI_point_uncertainty_ellipse_parseFrom
return point_uncertainty_ellipse_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;
}
if (uncertainty_ellipse_local_nonprim) {
OpenAPI_uncertainty_ellipse_free(uncertainty_ellipse_local_nonprim);
uncertainty_ellipse_local_nonprim = NULL;
}
return NULL;
}