From 65dc155a9c67f3f99a2e4a097182a1855a1dcf12 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 20 Mar 2023 22:02:17 +0100 Subject: make progname allocation bound to bar --- dbar.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dbar.c b/dbar.c index 8fdfd8c..ddbc42d 100644 --- a/dbar.c +++ b/dbar.c @@ -26,7 +26,7 @@ struct Bar { uint32_t clients; uint32_t active; uint32_t layout; - char *progname; + char progname[256]; uint32_t update_count; Canvas *canvas; struct zdwl_output_v1 *dwl_output; @@ -333,11 +333,7 @@ dwl_output_title(void *data, struct zdwl_output_v1 *zdwl_output_v1, const char * { Bar *bar = data; - if (bar->progname) - free(bar->progname); - - bar->progname = malloc(strlen(title)); - strcpy(bar->progname, title); + strncpy(bar->progname, title, 256); } -- cgit v1.2.3-70-g09d2