summaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Daniel Lockyer <thisisdaniellockyer@gmail.com>2016-04-29 18:07:38 +0100
committerLibravatar Daniel Lockyer <thisisdaniellockyer@gmail.com>2016-04-29 18:07:38 +0100
commitcdf017ceea0d09a6d5745c18cc0c8ae6232b49fa (patch)
tree029d63b6bfdc294a93f23098ac8e6151577aa346 /sway/config.c
parentsway/config.c: config_home is the result of a malloc but was never freed (diff)
downloadsway-cdf017ceea0d09a6d5745c18cc0c8ae6232b49fa.tar.gz
sway-cdf017ceea0d09a6d5745c18cc0c8ae6232b49fa.tar.zst
sway-cdf017ceea0d09a6d5745c18cc0c8ae6232b49fa.zip
sway/config.c: wordexp has a corresponding wordfree which was never used
I had to change the assignment to path to be wrapped by strdup as we pass the data out of the method.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index 06654223..f60decb5 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -277,8 +277,9 @@ static char *get_config_path(void) {
277 int i; 277 int i;
278 for (i = 0; i < (int)(sizeof(config_paths) / sizeof(char *)); ++i) { 278 for (i = 0; i < (int)(sizeof(config_paths) / sizeof(char *)); ++i) {
279 if (wordexp(config_paths[i], &p, 0) == 0) { 279 if (wordexp(config_paths[i], &p, 0) == 0) {
280 path = p.we_wordv[0]; 280 path = strdup(p.we_wordv[0]);
281 if (file_exists(path)) { 281 if (file_exists(path)) {
282 wordfree(&p);
282 return path; 283 return path;
283 } 284 }
284 } 285 }