mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -5,32 +5,51 @@
|
|||
|
||||
OpenAPI_object_t *OpenAPI_object_create(void)
|
||||
{
|
||||
OpenAPI_object_t *object = ogs_malloc(sizeof(OpenAPI_object_t));
|
||||
ogs_assert(object);
|
||||
OpenAPI_object_t *object = ogs_calloc(1, sizeof(OpenAPI_object_t));
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
void OpenAPI_object_free(OpenAPI_object_t *object)
|
||||
{
|
||||
if (!object) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (object->temporary) {
|
||||
ogs_free(object->temporary);
|
||||
object->temporary = NULL;
|
||||
}
|
||||
|
||||
ogs_free (object);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_object_convertToJSON(OpenAPI_object_t *object)
|
||||
{
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
if (!object) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
fail:
|
||||
cJSON_Delete(item);
|
||||
return NULL;
|
||||
if (!object->temporary) {
|
||||
return cJSON_Parse("{}");
|
||||
}
|
||||
|
||||
return cJSON_Parse(object->temporary);
|
||||
}
|
||||
|
||||
OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *objectJSON)
|
||||
OpenAPI_object_t *OpenAPI_object_parseFromJSON(cJSON *json)
|
||||
{
|
||||
OpenAPI_object_t *object = NULL;
|
||||
if (!json) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_object_t *object = OpenAPI_object_create();
|
||||
if (!object) {
|
||||
goto end;
|
||||
}
|
||||
object->temporary = cJSON_Print(json);
|
||||
return object;
|
||||
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue