diff options
-rw-r--r-- | sway/config.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sway/config.c b/sway/config.c index 66a3fa21..e74bfb65 100644 --- a/sway/config.c +++ b/sway/config.c @@ -71,8 +71,8 @@ static const char *search_paths[] = { }; static char *get_config_path() { - char *home = getenv("HOME"); - char *config = getenv("XDG_CONFIG_HOME"); + char *home = strdup(getenv("HOME")); + char *config = strdup(getenv("XDG_CONFIG_HOME")); if (!config) { const char *def = "/.config/sway"; config = malloc(strlen(home) + strlen(def) + 1); @@ -130,6 +130,8 @@ static char *get_config_path() { _continue: free_config(temp_config); + free(home); + free(config); return test; } |