X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=8e94b163a7cd0d553f6bea8c4917f2399abd4a60;hb=13f103ac8c4b74ea05658a6a71d03d98b22a7253;hp=14716c78e5750389558d563b964045d7dec325a4;hpb=f3c7ca7092331f0c6497e5b7dd833a3583d24184;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 14716c7..8e94b16 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -1848,7 +1848,7 @@ bar_refresh(void) void bar_setup(struct swm_region *r) { - char *font, *fontpos; + char *font, *fontpos, *dup, *search; int count; xcb_screen_t *screen = get_screen(r->s->idx); uint32_t wa[3]; @@ -1861,7 +1861,10 @@ bar_setup(struct swm_region *r) err(1, "bar_setup: calloc: failed to allocate memory."); if (bar_font == NULL) { - while ((font = strsep(&bar_fonts, ",")) != NULL) { + if ((dup = strdup(bar_fonts)) == NULL) + errx(1, "insufficient memory."); + search = dup; + while ((font = strsep(&search, ",")) != NULL) { if (*font == '\0') continue; @@ -1889,6 +1892,7 @@ bar_setup(struct swm_region *r) break; } } + free(dup); } if (bar_font == NULL)