]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
client: Free command parser after event loop
authorRay Strode <rstrode@redhat.com>
Tue, 12 Apr 2022 17:30:32 +0000 (13:30 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 12 Apr 2022 20:20:20 +0000 (16:20 -0400)
commit ed7b1690f0054888795059c2ef6ddd2f8107786a added an explicit
command parser free call on exit to make memory analysis tools
give better results.

That commit freed the command parser a little too early, though,
before the event loop gets freed and the event loop exit handlers
are run.

The command parser uses an exit handler to clear a weak reference
on the event loop, so freeing the command parser before the event
loop can lead to crash.

This commit moves the free call a little lower.

Related: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/175

src/client/plymouth.c

index c23133683b51c687c7bc07eb19a188ece30d5c23..4c95e6884ba0debecaf4521147bb7a405871af48 100644 (file)
@@ -1219,12 +1219,12 @@ 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);
 
+        ply_command_parser_free (state.command_parser);
+
         return exit_code;
 }
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */