[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_app_descriptor_t *OpenAPI_app_descriptor_create(
void OpenAPI_app_descriptor_free(OpenAPI_app_descriptor_t *app_descriptor)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == app_descriptor) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(app_descriptor->os_id);
ogs_free(app_descriptor->app_id);
if (app_descriptor->os_id) {
ogs_free(app_descriptor->os_id);
app_descriptor->os_id = NULL;
}
if (app_descriptor->app_id) {
ogs_free(app_descriptor->app_id);
app_descriptor->app_id = NULL;
}
ogs_free(app_descriptor);
}
cJSON *OpenAPI_app_descriptor_convertToJSON(OpenAPI_app_descriptor_t *app_descriptor)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (app_descriptor == NULL) {
ogs_error("OpenAPI_app_descriptor_convertToJSON() failed [AppDescriptor]");
@ -60,27 +68,28 @@ end:
OpenAPI_app_descriptor_t *OpenAPI_app_descriptor_parseFromJSON(cJSON *app_descriptorJSON)
{
OpenAPI_app_descriptor_t *app_descriptor_local_var = NULL;
cJSON *os_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "osId");
OpenAPI_lnode_t *node = NULL;
cJSON *os_id = NULL;
cJSON *app_id = NULL;
os_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "osId");
if (os_id) {
if (!cJSON_IsString(os_id)) {
if (!cJSON_IsString(os_id) && !cJSON_IsNull(os_id)) {
ogs_error("OpenAPI_app_descriptor_parseFromJSON() failed [os_id]");
goto end;
}
}
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "appId");
app_id = cJSON_GetObjectItemCaseSensitive(app_descriptorJSON, "appId");
if (app_id) {
if (!cJSON_IsString(app_id)) {
if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) {
ogs_error("OpenAPI_app_descriptor_parseFromJSON() failed [app_id]");
goto end;
}
}
app_descriptor_local_var = OpenAPI_app_descriptor_create (
os_id ? ogs_strdup(os_id->valuestring) : NULL,
app_id ? ogs_strdup(app_id->valuestring) : NULL
os_id && !cJSON_IsNull(os_id) ? ogs_strdup(os_id->valuestring) : NULL,
app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL
);
return app_descriptor_local_var;