From: Eric Curtin Date: Mon, 28 Mar 2022 14:52:49 +0000 (+0100) Subject: client: call cleanup functions everytime we return from main X-Git-Tag: 23.51.283~95^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed7b1690f0054888795059c2ef6ddd2f8107786a;p=thirdparty%2Fplymouth.git client: call cleanup functions everytime we return from main We were not cleaning up allocated resources in many of the code execution paths in main() --- diff --git a/src/client/plymouth.c b/src/client/plymouth.c index 304ea8e2..c2313368 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -1065,7 +1065,8 @@ main (int argc, ply_error ("%s", help_string); free (help_string); - return 1; + exit_code = 1; + goto out; } ply_command_parser_get_options (state.command_parser, @@ -1097,7 +1098,7 @@ main (int argc, printf ("%s", help_string); free (help_string); - return 0; + goto out; } if (ply_kernel_command_line_has_argument ("plymouth.debug") && !ply_is_tracing ()) @@ -1108,7 +1109,7 @@ main (int argc, if (should_get_plugin_path) { printf ("%s\n", PLYMOUTH_PLUGIN_PATH); - return 0; + goto out; } is_connected = ply_boot_client_connect (state.client, @@ -1119,15 +1120,17 @@ main (int argc, if (should_ping) { ply_trace ("ping failed"); - return 1; + exit_code = 1; + goto out; } if (should_check_for_active_vt) { ply_trace ("has active vt? failed"); - return 1; + exit_code = 1; + goto out; } if (should_wait) { ply_trace ("no need to wait"); - return 0; + goto out; } } @@ -1215,6 +1218,9 @@ main (int argc, exit_code = ply_event_loop_run (state.loop); +out: + ply_command_parser_free (state.command_parser); + ply_boot_client_free (state.client); ply_event_loop_free (state.loop);