mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-09 03:38:09 +02:00
Merge branch 'coverity-fixes' into 'master'
Coverity fixes See merge request plymouth/plymouth!6
This commit is contained in:
commit
a588b3f7d1
9 changed files with 97 additions and 15 deletions
|
|
@ -168,7 +168,7 @@ rev_lib_symlinks() {
|
|||
# It handles making symlinks according to how the original library
|
||||
# is referenced.
|
||||
inst_library() {
|
||||
local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
|
||||
local _src="$1" _dest=${2:-$1} _reallib _symlink
|
||||
strstr "$1" "/" || return 1
|
||||
[[ -e $initdir/$_dest ]] && return 0
|
||||
if [[ -L $_src ]]; then
|
||||
|
|
|
|||
|
|
@ -208,8 +208,10 @@ ply_boot_splash_load (ply_boot_splash_t *splash)
|
|||
|
||||
key_file = ply_key_file_new (splash->theme_path);
|
||||
|
||||
if (!ply_key_file_load (key_file))
|
||||
if (!ply_key_file_load (key_file)) {
|
||||
ply_key_file_free (key_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
module_name = ply_key_file_get_value (key_file, "Plymouth Theme", "ModuleName");
|
||||
|
||||
|
|
|
|||
|
|
@ -496,8 +496,10 @@ ply_event_loop_new (void)
|
|||
|
||||
loop->signal_dispatcher = ply_signal_dispatcher_new ();
|
||||
|
||||
if (loop->signal_dispatcher == NULL)
|
||||
if (loop->signal_dispatcher == NULL) {
|
||||
ply_event_loop_free (loop);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ply_event_loop_watch_fd (loop,
|
||||
ply_signal_dispatcher_receiver_fd,
|
||||
|
|
|
|||
13
src/main.c
13
src/main.c
|
|
@ -296,8 +296,8 @@ load_settings (state_t *state,
|
|||
{
|
||||
ply_key_file_t *key_file = NULL;
|
||||
bool settings_loaded = false;
|
||||
const char *scale_string;
|
||||
const char *splash_string;
|
||||
char *scale_string = NULL;
|
||||
char *splash_string = NULL;
|
||||
|
||||
ply_trace ("Trying to load %s", path);
|
||||
key_file = ply_key_file_new (path);
|
||||
|
|
@ -323,24 +323,27 @@ load_settings (state_t *state,
|
|||
}
|
||||
|
||||
if (isnan (state->splash_delay)) {
|
||||
const char *delay_string;
|
||||
char *delay_string;
|
||||
|
||||
delay_string = ply_key_file_get_value (key_file, "Daemon", "ShowDelay");
|
||||
|
||||
if (delay_string != NULL) {
|
||||
state->splash_delay = atof (delay_string);
|
||||
ply_trace ("Splash delay is set to %lf", state->splash_delay);
|
||||
free (delay_string);
|
||||
}
|
||||
}
|
||||
|
||||
if (isnan (state->device_timeout)) {
|
||||
const char *timeout_string;
|
||||
char *timeout_string;
|
||||
|
||||
timeout_string = ply_key_file_get_value (key_file, "Daemon", "DeviceTimeout");
|
||||
|
||||
if (timeout_string != NULL) {
|
||||
state->device_timeout = atof (timeout_string);
|
||||
ply_trace ("Device timeout is set to %lf", state->device_timeout);
|
||||
|
||||
free (timeout_string);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,10 +351,12 @@ load_settings (state_t *state,
|
|||
|
||||
if (scale_string != NULL) {
|
||||
ply_set_device_scale (strtoul (scale_string, NULL, 0));
|
||||
free (scale_string);
|
||||
}
|
||||
|
||||
settings_loaded = true;
|
||||
out:
|
||||
free (splash_string);
|
||||
ply_key_file_free (key_file);
|
||||
|
||||
return settings_loaded;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,10 @@ static script_return_t image_text (script_state_t *state,
|
|||
}
|
||||
script_obj_unref (align_obj);
|
||||
|
||||
if (!text) return script_return_obj_null ();
|
||||
if (!text) {
|
||||
free (font);
|
||||
return script_return_obj_null ();
|
||||
}
|
||||
|
||||
label = ply_label_new ();
|
||||
ply_label_set_text (label, text);
|
||||
|
|
|
|||
|
|
@ -741,12 +741,14 @@ void
|
|||
script_lib_sprite_refresh (script_lib_sprite_data_t *data)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
ply_region_t *region = ply_region_new ();
|
||||
ply_region_t *region;
|
||||
ply_list_t *rectable_list;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
region = ply_region_new ();
|
||||
|
||||
ply_list_sort_stable (data->sprite_list, &sprite_compare_z);
|
||||
|
||||
node = ply_list_get_first_node (data->sprite_list);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ static script_op_t *script_parse_op (script_scan_t *scan);
|
|||
static script_exp_t *script_parse_exp (script_scan_t *scan);
|
||||
static ply_list_t *script_parse_op_list (script_scan_t *scan);
|
||||
static void script_parse_op_list_free (ply_list_t *op_list);
|
||||
static void script_parse_exp_free (script_exp_t *exp);
|
||||
|
||||
static script_exp_t *script_parse_new_exp (script_exp_type_t type,
|
||||
script_debug_location_t *location)
|
||||
|
|
@ -225,10 +226,33 @@ static void script_parse_advance_scan_by_string (script_scan_t *scan,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_parameter_list (script_scan_t *scan,
|
||||
ply_list_t *parameter_list)
|
||||
{
|
||||
if (parameter_list != NULL) {
|
||||
ply_list_node_t *node;
|
||||
|
||||
node = ply_list_get_first_node (parameter_list);
|
||||
while (node != NULL) {
|
||||
ply_list_node_t *next_node;
|
||||
char *parameter;
|
||||
|
||||
parameter = ply_list_node_get_data (node);
|
||||
next_node = ply_list_get_next_node (parameter_list, node);
|
||||
free (parameter);
|
||||
ply_list_remove_node (parameter_list, node);
|
||||
|
||||
node = next_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static script_function_t *script_parse_function_def (script_scan_t *scan)
|
||||
{
|
||||
script_scan_token_t *curtoken = script_scan_get_current_token (scan);
|
||||
ply_list_t *parameter_list;
|
||||
script_function_t *function = NULL;
|
||||
ply_list_t *parameter_list = NULL;
|
||||
|
||||
if (!script_scan_token_is_symbol_of_value (curtoken, '(')) {
|
||||
script_parse_error (&curtoken->location,
|
||||
|
|
@ -243,7 +267,7 @@ static script_function_t *script_parse_function_def (script_scan_t *scan)
|
|||
if (!script_scan_token_is_identifier (curtoken)) {
|
||||
script_parse_error (&curtoken->location,
|
||||
"Function declaration parameters must be valid identifiers");
|
||||
return NULL;
|
||||
goto out;
|
||||
}
|
||||
char *parameter = strdup (curtoken->data.string);
|
||||
ply_list_append_data (parameter_list, parameter);
|
||||
|
|
@ -254,7 +278,7 @@ static script_function_t *script_parse_function_def (script_scan_t *scan)
|
|||
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
|
||||
script_parse_error (&curtoken->location,
|
||||
"Function declaration parameters must separated with ',' and terminated with a ')'");
|
||||
return NULL;
|
||||
goto out;
|
||||
}
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
}
|
||||
|
|
@ -263,9 +287,12 @@ static script_function_t *script_parse_function_def (script_scan_t *scan)
|
|||
|
||||
script_op_t *func_op = script_parse_op (scan);
|
||||
|
||||
script_function_t *function = script_function_script_new (func_op,
|
||||
NULL,
|
||||
parameter_list);
|
||||
function = script_function_script_new (func_op,
|
||||
NULL,
|
||||
parameter_list);
|
||||
parameter_list = NULL;
|
||||
out:
|
||||
free_parameter_list (scan, parameter_list);
|
||||
return function;
|
||||
}
|
||||
|
||||
|
|
@ -327,8 +354,18 @@ static script_exp_t *script_parse_exp_tm (script_scan_t *scan)
|
|||
curtoken = script_scan_get_current_token (scan);
|
||||
if (script_scan_token_is_symbol_of_value (curtoken, ']')) break;
|
||||
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
|
||||
ply_list_node_t *node;
|
||||
script_parse_error (&curtoken->location,
|
||||
"Set parameters should be separated with a ',' and terminated with a ']'");
|
||||
|
||||
|
||||
for (node = ply_list_get_first_node (parameters);
|
||||
node;
|
||||
node = ply_list_get_next_node (parameters, node)) {
|
||||
script_exp_t *sub = ply_list_node_get_data (node);
|
||||
script_parse_exp_free (sub);
|
||||
}
|
||||
ply_list_free (parameters);
|
||||
return NULL;
|
||||
}
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
|
|
@ -377,8 +414,18 @@ static script_exp_t *script_parse_exp_pi (script_scan_t *scan)
|
|||
curtoken = script_scan_get_current_token (scan);
|
||||
if (script_scan_token_is_symbol_of_value (curtoken, ')')) break;
|
||||
if (!script_scan_token_is_symbol_of_value (curtoken, ',')) {
|
||||
ply_list_node_t *node;
|
||||
|
||||
script_parse_error (&curtoken->location,
|
||||
"Function parameters should be separated with a ',' and terminated with a ')'");
|
||||
|
||||
for (node = ply_list_get_first_node (parameters);
|
||||
node;
|
||||
node = ply_list_get_next_node (parameters, node)) {
|
||||
script_exp_t *sub = ply_list_node_get_data (node);
|
||||
script_parse_exp_free (sub);
|
||||
}
|
||||
ply_list_free (parameters);
|
||||
return NULL;
|
||||
}
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
|
|
@ -992,6 +1039,7 @@ script_op_t *script_parse_file (const char *filename)
|
|||
curtoken = script_scan_get_current_token (scan);
|
||||
if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) {
|
||||
script_parse_error (&curtoken->location, "Unparsed characters at end of file");
|
||||
script_parse_op_list_free (list);
|
||||
return NULL;
|
||||
}
|
||||
script_op_t *op = script_parse_new_op_block (list, &location);
|
||||
|
|
@ -1015,6 +1063,7 @@ script_op_t *script_parse_string (const char *string,
|
|||
curtoken = script_scan_get_current_token (scan);
|
||||
if (curtoken->type != SCRIPT_SCAN_TOKEN_TYPE_EOF) {
|
||||
script_parse_error (&curtoken->location, "Unparsed characters at end of file");
|
||||
script_parse_op_list_free (list);
|
||||
return NULL;
|
||||
}
|
||||
script_op_t *op = script_parse_new_op_block (list, &location);
|
||||
|
|
|
|||
|
|
@ -662,6 +662,8 @@ create_plugin (ply_key_file_t *key_file)
|
|||
ply_trace ("unknown progress function %s, defaulting to linear", progress_function);
|
||||
plugin->progress_function = PROGRESS_FUNCTION_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
free (progress_function);
|
||||
}
|
||||
|
||||
plugin->views = ply_list_new ();
|
||||
|
|
|
|||
|
|
@ -386,6 +386,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
|
||||
ply_trace ("could not finish writing is-not-root nak: %m");
|
||||
|
||||
free (argument);
|
||||
free (command);
|
||||
return;
|
||||
}
|
||||
|
|
@ -466,6 +467,8 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
|
||||
if (server->deactivate_handler != NULL)
|
||||
server->deactivate_handler (server->user_data, deactivate_trigger, server);
|
||||
else
|
||||
ply_trigger_free (deactivate_trigger);
|
||||
|
||||
free (argument);
|
||||
free (command);
|
||||
|
|
@ -491,6 +494,8 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
|
||||
if (server->quit_handler != NULL)
|
||||
server->quit_handler (server->user_data, retain_splash, quit_trigger, server);
|
||||
else
|
||||
ply_trigger_free (quit_trigger);
|
||||
|
||||
free (argument);
|
||||
free (command);
|
||||
|
|
@ -511,6 +516,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
argument,
|
||||
answer,
|
||||
server);
|
||||
} else {
|
||||
ply_trigger_free (answer);
|
||||
free (argument);
|
||||
}
|
||||
/* will reply later
|
||||
*/
|
||||
|
|
@ -592,6 +600,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
argument,
|
||||
answer,
|
||||
server);
|
||||
} else {
|
||||
ply_trigger_free (answer);
|
||||
free (argument);
|
||||
}
|
||||
/* will reply later
|
||||
*/
|
||||
|
|
@ -621,6 +632,9 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
argument,
|
||||
answer,
|
||||
server);
|
||||
} else {
|
||||
ply_trigger_free (answer);
|
||||
free (argument);
|
||||
}
|
||||
/* will reply later
|
||||
*/
|
||||
|
|
@ -659,6 +673,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
|
||||
ply_trace ("could not finish writing nak: %m");
|
||||
|
||||
free (argument);
|
||||
free (command);
|
||||
return;
|
||||
}
|
||||
|
|
@ -670,6 +685,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK)))
|
||||
ply_trace ("could not finish writing ping reply: %m");
|
||||
|
||||
free (argument);
|
||||
free (command);
|
||||
return;
|
||||
}
|
||||
|
|
@ -678,6 +694,7 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK,
|
||||
strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK)))
|
||||
ply_trace ("could not finish writing ack: %m");
|
||||
free (argument);
|
||||
free (command);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue