[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_link_t *OpenAPI_link_create(
void OpenAPI_link_free(OpenAPI_link_t *link)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == link) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(link->href);
if (link->href) {
ogs_free(link->href);
link->href = NULL;
}
ogs_free(link);
}
cJSON *OpenAPI_link_convertToJSON(OpenAPI_link_t *link)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (link == NULL) {
ogs_error("OpenAPI_link_convertToJSON() failed [Link]");
@ -50,17 +55,18 @@ end:
OpenAPI_link_t *OpenAPI_link_parseFromJSON(cJSON *linkJSON)
{
OpenAPI_link_t *link_local_var = NULL;
cJSON *href = cJSON_GetObjectItemCaseSensitive(linkJSON, "href");
OpenAPI_lnode_t *node = NULL;
cJSON *href = NULL;
href = cJSON_GetObjectItemCaseSensitive(linkJSON, "href");
if (href) {
if (!cJSON_IsString(href)) {
if (!cJSON_IsString(href) && !cJSON_IsNull(href)) {
ogs_error("OpenAPI_link_parseFromJSON() failed [href]");
goto end;
}
}
link_local_var = OpenAPI_link_create (
href ? ogs_strdup(href->valuestring) : NULL
href && !cJSON_IsNull(href) ? ogs_strdup(href->valuestring) : NULL
);
return link_local_var;