Reduce code complexity slightly
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
d802f0e301
commit
66cc0e87c3
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue