]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-label: Don't crash if label plugin fails
authorFabian Vogt <fvogt@suse.com>
Fri, 6 Mar 2020 09:28:04 +0000 (10:28 +0100)
committerRay Strode <rstrode@redhat.com>
Mon, 17 Oct 2022 17:04:02 +0000 (13:04 -0400)
Right now if the label plugin fails during initialization, the plymouth
daemon crashes.

This commit adds a NULL check to fail more gracefully.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Fabian Vogt <fvogt@suse.com>
src/libply-splash-graphics/ply-label.c

index b1e99f0d496a58d5c7c5d13a1bc636606f48c156..935f34465a401105375271f78a3b6d3cfa9b80ee 100644 (file)
@@ -125,6 +125,15 @@ ply_label_load_plugin (ply_label_t *label)
 
         label->control = label->plugin_interface->create_control ();
 
+        if (label->control == NULL) {
+                ply_save_errno ();
+                label->plugin_interface = NULL;
+                ply_close_module (label->module_handle);
+                label->module_handle = NULL;
+                ply_restore_errno ();
+                return false;
+        }
+
         if (label->text != NULL)
                 label->plugin_interface->set_text_for_control (label->control,
                                                                label->text);