[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

@ -20,18 +20,26 @@ OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_create(
void OpenAPI_temporal_validity_free(OpenAPI_temporal_validity_t *temporal_validity)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == temporal_validity) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(temporal_validity->start_time);
ogs_free(temporal_validity->stop_time);
if (temporal_validity->start_time) {
ogs_free(temporal_validity->start_time);
temporal_validity->start_time = NULL;
}
if (temporal_validity->stop_time) {
ogs_free(temporal_validity->stop_time);
temporal_validity->stop_time = NULL;
}
ogs_free(temporal_validity);
}
cJSON *OpenAPI_temporal_validity_convertToJSON(OpenAPI_temporal_validity_t *temporal_validity)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (temporal_validity == NULL) {
ogs_error("OpenAPI_temporal_validity_convertToJSON() failed [TemporalValidity]");
@ -60,27 +68,28 @@ end:
OpenAPI_temporal_validity_t *OpenAPI_temporal_validity_parseFromJSON(cJSON *temporal_validityJSON)
{
OpenAPI_temporal_validity_t *temporal_validity_local_var = NULL;
cJSON *start_time = cJSON_GetObjectItemCaseSensitive(temporal_validityJSON, "startTime");
OpenAPI_lnode_t *node = NULL;
cJSON *start_time = NULL;
cJSON *stop_time = NULL;
start_time = cJSON_GetObjectItemCaseSensitive(temporal_validityJSON, "startTime");
if (start_time) {
if (!cJSON_IsString(start_time)) {
if (!cJSON_IsString(start_time) && !cJSON_IsNull(start_time)) {
ogs_error("OpenAPI_temporal_validity_parseFromJSON() failed [start_time]");
goto end;
}
}
cJSON *stop_time = cJSON_GetObjectItemCaseSensitive(temporal_validityJSON, "stopTime");
stop_time = cJSON_GetObjectItemCaseSensitive(temporal_validityJSON, "stopTime");
if (stop_time) {
if (!cJSON_IsString(stop_time)) {
if (!cJSON_IsString(stop_time) && !cJSON_IsNull(stop_time)) {
ogs_error("OpenAPI_temporal_validity_parseFromJSON() failed [stop_time]");
goto end;
}
}
temporal_validity_local_var = OpenAPI_temporal_validity_create (
start_time ? ogs_strdup(start_time->valuestring) : NULL,
stop_time ? ogs_strdup(stop_time->valuestring) : NULL
start_time && !cJSON_IsNull(start_time) ? ogs_strdup(start_time->valuestring) : NULL,
stop_time && !cJSON_IsNull(stop_time) ? ogs_strdup(stop_time->valuestring) : NULL
);
return temporal_validity_local_var;