summaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sway/config.c b/sway/config.c
index be9f70c1..0dc53c75 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -28,6 +28,7 @@ static char *get_config_path() {
if (exists(temp)) {
return temp;
}
+ free(temp);
// Check XDG_CONFIG_HOME with fallback to ~/.config/
sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/sway/config");
@@ -41,7 +42,7 @@ static char *get_config_path() {
} else {
name = "/sway/config";
temp = malloc(strlen(xdg_config_home) + strlen(name) + 1);
- strcpy(xdg_config_home, home);
+ strcpy(temp, xdg_config_home);
strcat(temp, name);
}
if (exists(temp)) {
@@ -54,6 +55,7 @@ static char *get_config_path() {
if (exists(temp)) {
return temp;
}
+ free(temp);
// Check XDG_CONFIG_DIRS
sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS");
@@ -70,6 +72,7 @@ static char *get_config_path() {
free_flat_list(paths);
return temp;
}
+ free(temp);
}
free_flat_list(paths);
}
@@ -83,6 +86,7 @@ static char *get_config_path() {
if (exists(temp)) {
return temp;
}
+ free(temp);
sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_HOME/i3/config");
if (xdg_config_home == NULL) {
@@ -94,7 +98,7 @@ static char *get_config_path() {
} else {
name = "/i3/config";
temp = malloc(strlen(xdg_config_home) + strlen(name) + 1);
- strcpy(xdg_config_home, home);
+ strcpy(temp, xdg_config_home);
strcat(temp, name);
}
if (exists(temp)) {
@@ -106,6 +110,7 @@ static char *get_config_path() {
if (exists(temp)) {
return temp;
}
+ free(temp);
sway_log(L_DEBUG, "Trying to find config in XDG_CONFIG_DIRS");
if (xdg_config_dirs != NULL) {
@@ -120,6 +125,7 @@ static char *get_config_path() {
free_flat_list(paths);
return temp;
}
+ free(temp);
}
free_flat_list(paths);
}