Reduce code complexity slightly

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2023-12-07 22:30:24 +01:00
parent d802f0e301
commit 66cc0e87c3
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
1 changed files with 4 additions and 8 deletions

View File

@ -605,8 +605,7 @@ static int api_config_get(struct ftl_conn *api)
}
// Release allocated memory
if(requested_path != NULL)
free_config_path(requested_path);
free_config_path(requested_path);
cJSON *json = JSON_NEW_OBJECT();
@ -852,8 +851,7 @@ static int api_config_put_delete(struct ftl_conn *api)
if(min_level < 2)
{
// Release allocated memory
if(requested_path != NULL)
free_config_path(requested_path);
free_config_path(requested_path);
return send_json_error(api, 400,
"bad_request",
@ -899,8 +897,7 @@ static int api_config_put_delete(struct ftl_conn *api)
{
char *key = strdup(new_item->k);
free_config(&newconf);
if(requested_path != NULL)
free_config_path(requested_path);
free_config_path(requested_path);
return send_json_error_free(api, 400,
"bad_request",
"Config items set via environment variables cannot be changed via the API",
@ -965,8 +962,7 @@ static int api_config_put_delete(struct ftl_conn *api)
}
// Release allocated memory
if(requested_path != NULL)
free_config_path(requested_path);
free_config_path(requested_path);
// Error 404 if not found
if(!found || message != NULL)