diff --git a/src/common/dir.c b/src/common/dir.c index d474c313..5b1d14a5 100644 --- a/src/common/dir.c +++ b/src/common/dir.c @@ -87,10 +87,11 @@ find_dir(struct ctx *ctx) { char *debug = getenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME"); + struct buf prefix; + buf_init(&prefix); for (int i = 0; ctx->dirs[i].path; i++) { struct dir d = ctx->dirs[i]; - struct buf prefix; - buf_init(&prefix); + buf_clear(&prefix); /* * Replace (rather than augment) $HOME/.config with @@ -100,7 +101,6 @@ find_dir(struct ctx *ctx) char *pfxenv = getenv(d.prefix); buf_add(&prefix, pfxenv ? pfxenv : d.default_prefix); if (!prefix.len) { - buf_finish(&prefix); continue; } @@ -130,8 +130,8 @@ find_dir(struct ctx *ctx) wl_list_append(ctx->list, &path->link); } g_strfreev(prefixes); - buf_finish(&prefix); } + buf_finish(&prefix); } void