]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-label: Make NULL safe (again)
authorRay Strode <rstrode@redhat.com>
Fri, 22 Dec 2023 13:27:30 +0000 (08:27 -0500)
committerRay Strode <rstrode@redhat.com>
Sun, 24 Dec 2023 20:46:33 +0000 (15:46 -0500)
commit a045f01568f53ca10ef8b76d9f507ccd3546e9d8 tried to make ply-label
NULL safe, but missed a strdup.

This commit fixes that.

src/libply-splash-graphics/ply-label.c

index 0c03ebc5c827d71ada17f54541d86d5d7c50e5a8..f49dd7f4ed11a62abfbe85ec286c359839240150 100644 (file)
@@ -248,7 +248,10 @@ ply_label_set_text (ply_label_t *label,
                     const char  *text)
 {
         free (label->text);
-        label->text = strdup (text);
+        label->text = NULL;
+
+        if (text != NULL)
+                label->text = strdup (text);
 
         if (label->rich_text) {
                 ply_rich_text_drop_reference (label->rich_text);
@@ -259,7 +262,7 @@ ply_label_set_text (ply_label_t *label,
                 return;
 
         label->plugin_interface->set_text_for_control (label->control,
-                                                       text?: "");
+                                                       label->text?: "");
 }
 
 void