diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-19 08:22:18 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-19 08:22:18 -0400 |
commit | 1ec8e082a2693418b79071e052e45a040baab009 (patch) | |
tree | 20a4c7219bf154e4c78314a6f22e7d1b35a9ea2b /sway | |
parent | Refactor config file loading (diff) | |
download | sway-1ec8e082a2693418b79071e052e45a040baab009.tar.gz sway-1ec8e082a2693418b79071e052e45a040baab009.tar.zst sway-1ec8e082a2693418b79071e052e45a040baab009.zip |
Free environment vars after loading config
Thanks @SyedAmerGilani
Diffstat (limited to 'sway')
-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[] = { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | static char *get_config_path() { | 73 | static char *get_config_path() { |
74 | char *home = getenv("HOME"); | 74 | char *home = strdup(getenv("HOME")); |
75 | char *config = getenv("XDG_CONFIG_HOME"); | 75 | char *config = strdup(getenv("XDG_CONFIG_HOME")); |
76 | if (!config) { | 76 | if (!config) { |
77 | const char *def = "/.config/sway"; | 77 | const char *def = "/.config/sway"; |
78 | config = malloc(strlen(home) + strlen(def) + 1); | 78 | config = malloc(strlen(home) + strlen(def) + 1); |
@@ -130,6 +130,8 @@ static char *get_config_path() { | |||
130 | 130 | ||
131 | _continue: | 131 | _continue: |
132 | free_config(temp_config); | 132 | free_config(temp_config); |
133 | free(home); | ||
134 | free(config); | ||
133 | return test; | 135 | return test; |
134 | } | 136 | } |
135 | 137 | ||