[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

@ -18,17 +18,22 @@ OpenAPI_report_item_t *OpenAPI_report_item_create(
void OpenAPI_report_item_free(OpenAPI_report_item_t *report_item)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == report_item) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(report_item->path);
if (report_item->path) {
ogs_free(report_item->path);
report_item->path = NULL;
}
ogs_free(report_item);
}
cJSON *OpenAPI_report_item_convertToJSON(OpenAPI_report_item_t *report_item)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (report_item == NULL) {
ogs_error("OpenAPI_report_item_convertToJSON() failed [ReportItem]");
@ -36,6 +41,10 @@ cJSON *OpenAPI_report_item_convertToJSON(OpenAPI_report_item_t *report_item)
}
item = cJSON_CreateObject();
if (!report_item->path) {
ogs_error("OpenAPI_report_item_convertToJSON() failed [path]");
return NULL;
}
if (cJSON_AddStringToObject(item, "path", report_item->path) == NULL) {
ogs_error("OpenAPI_report_item_convertToJSON() failed [path]");
goto end;
@ -48,12 +57,13 @@ end:
OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON)
{
OpenAPI_report_item_t *report_item_local_var = NULL;
cJSON *path = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "path");
OpenAPI_lnode_t *node = NULL;
cJSON *path = NULL;
path = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "path");
if (!path) {
ogs_error("OpenAPI_report_item_parseFromJSON() failed [path]");
goto end;
}
if (!cJSON_IsString(path)) {
ogs_error("OpenAPI_report_item_parseFromJSON() failed [path]");
goto end;