mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 14:20: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
|
|
@ -20,18 +20,26 @@ OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_create(
|
|||
|
||||
void OpenAPI_valid_time_period_free(OpenAPI_valid_time_period_t *valid_time_period)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == valid_time_period) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(valid_time_period->start_time);
|
||||
ogs_free(valid_time_period->end_time);
|
||||
if (valid_time_period->start_time) {
|
||||
ogs_free(valid_time_period->start_time);
|
||||
valid_time_period->start_time = NULL;
|
||||
}
|
||||
if (valid_time_period->end_time) {
|
||||
ogs_free(valid_time_period->end_time);
|
||||
valid_time_period->end_time = NULL;
|
||||
}
|
||||
ogs_free(valid_time_period);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_valid_time_period_convertToJSON(OpenAPI_valid_time_period_t *valid_time_period)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (valid_time_period == NULL) {
|
||||
ogs_error("OpenAPI_valid_time_period_convertToJSON() failed [ValidTimePeriod]");
|
||||
|
|
@ -60,27 +68,28 @@ end:
|
|||
OpenAPI_valid_time_period_t *OpenAPI_valid_time_period_parseFromJSON(cJSON *valid_time_periodJSON)
|
||||
{
|
||||
OpenAPI_valid_time_period_t *valid_time_period_local_var = NULL;
|
||||
cJSON *start_time = cJSON_GetObjectItemCaseSensitive(valid_time_periodJSON, "startTime");
|
||||
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *start_time = NULL;
|
||||
cJSON *end_time = NULL;
|
||||
start_time = cJSON_GetObjectItemCaseSensitive(valid_time_periodJSON, "startTime");
|
||||
if (start_time) {
|
||||
if (!cJSON_IsString(start_time)) {
|
||||
if (!cJSON_IsString(start_time) && !cJSON_IsNull(start_time)) {
|
||||
ogs_error("OpenAPI_valid_time_period_parseFromJSON() failed [start_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *end_time = cJSON_GetObjectItemCaseSensitive(valid_time_periodJSON, "endTime");
|
||||
|
||||
end_time = cJSON_GetObjectItemCaseSensitive(valid_time_periodJSON, "endTime");
|
||||
if (end_time) {
|
||||
if (!cJSON_IsString(end_time)) {
|
||||
if (!cJSON_IsString(end_time) && !cJSON_IsNull(end_time)) {
|
||||
ogs_error("OpenAPI_valid_time_period_parseFromJSON() failed [end_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
valid_time_period_local_var = OpenAPI_valid_time_period_create (
|
||||
start_time ? ogs_strdup(start_time->valuestring) : NULL,
|
||||
end_time ? ogs_strdup(end_time->valuestring) : NULL
|
||||
start_time && !cJSON_IsNull(start_time) ? ogs_strdup(start_time->valuestring) : NULL,
|
||||
end_time && !cJSON_IsNull(end_time) ? ogs_strdup(end_time->valuestring) : NULL
|
||||
);
|
||||
|
||||
return valid_time_period_local_var;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue