[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_time_window_t *OpenAPI_time_window_create(
void OpenAPI_time_window_free(OpenAPI_time_window_t *time_window)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == time_window) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(time_window->start_time);
ogs_free(time_window->stop_time);
if (time_window->start_time) {
ogs_free(time_window->start_time);
time_window->start_time = NULL;
}
if (time_window->stop_time) {
ogs_free(time_window->stop_time);
time_window->stop_time = NULL;
}
ogs_free(time_window);
}
cJSON *OpenAPI_time_window_convertToJSON(OpenAPI_time_window_t *time_window)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (time_window == NULL) {
ogs_error("OpenAPI_time_window_convertToJSON() failed [TimeWindow]");
@ -39,11 +47,19 @@ cJSON *OpenAPI_time_window_convertToJSON(OpenAPI_time_window_t *time_window)
}
item = cJSON_CreateObject();
if (!time_window->start_time) {
ogs_error("OpenAPI_time_window_convertToJSON() failed [start_time]");
return NULL;
}
if (cJSON_AddStringToObject(item, "startTime", time_window->start_time) == NULL) {
ogs_error("OpenAPI_time_window_convertToJSON() failed [start_time]");
goto end;
}
if (!time_window->stop_time) {
ogs_error("OpenAPI_time_window_convertToJSON() failed [stop_time]");
return NULL;
}
if (cJSON_AddStringToObject(item, "stopTime", time_window->stop_time) == NULL) {
ogs_error("OpenAPI_time_window_convertToJSON() failed [stop_time]");
goto end;
@ -56,23 +72,24 @@ end:
OpenAPI_time_window_t *OpenAPI_time_window_parseFromJSON(cJSON *time_windowJSON)
{
OpenAPI_time_window_t *time_window_local_var = NULL;
cJSON *start_time = cJSON_GetObjectItemCaseSensitive(time_windowJSON, "startTime");
OpenAPI_lnode_t *node = NULL;
cJSON *start_time = NULL;
cJSON *stop_time = NULL;
start_time = cJSON_GetObjectItemCaseSensitive(time_windowJSON, "startTime");
if (!start_time) {
ogs_error("OpenAPI_time_window_parseFromJSON() failed [start_time]");
goto end;
}
if (!cJSON_IsString(start_time)) {
ogs_error("OpenAPI_time_window_parseFromJSON() failed [start_time]");
goto end;
}
cJSON *stop_time = cJSON_GetObjectItemCaseSensitive(time_windowJSON, "stopTime");
stop_time = cJSON_GetObjectItemCaseSensitive(time_windowJSON, "stopTime");
if (!stop_time) {
ogs_error("OpenAPI_time_window_parseFromJSON() failed [stop_time]");
goto end;
}
if (!cJSON_IsString(stop_time)) {
ogs_error("OpenAPI_time_window_parseFromJSON() failed [stop_time]");
goto end;