]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: fix freeing static strings 1735/head
authorshdown <shdownnine@gmail.com>
Tue, 2 Jun 2015 20:08:08 +0000 (23:08 +0300)
committershdown <shdownnine@gmail.com>
Tue, 2 Jun 2015 20:29:24 +0000 (23:29 +0300)
name and color fields of blocks are freed in clear_statusline, so they
need to be strdup'ed.

i3bar/src/child.c

index e5ce209d1562959d47862db37a9d1025822afb96..e369c54deb190a0e3651c34e0fb3cab7e1d5525c 100644 (file)
@@ -107,14 +107,14 @@ __attribute__((format(printf, 1, 2))) static void set_statusline_error(const cha
 
     struct status_block *err_block = scalloc(sizeof(struct status_block));
     err_block->full_text = i3string_from_utf8("Error: ");
-    err_block->name = "error";
-    err_block->color = "red";
+    err_block->name = sstrdup("error");
+    err_block->color = sstrdup("red");
     err_block->no_separator = true;
 
     struct status_block *message_block = scalloc(sizeof(struct status_block));
     message_block->full_text = i3string_from_utf8(message);
-    message_block->name = "error_message";
-    message_block->color = "red";
+    message_block->name = sstrdup("error_message");
+    message_block->color = sstrdup("red");
     message_block->no_separator = true;
 
     TAILQ_INSERT_HEAD(&statusline_head, err_block, blocks);