aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-13 12:17:55 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-13 12:17:55 +0000
commit74c3b4be1ad846aeff1ae372317e1a0857c63e44 (patch)
tree4858fc6415b46c8aefa91b669b052f9e03815e10 /main.c
parentrender: render_margin: add 'damage_{top,bottom,left,right}' arguments (diff)
main: free 'cwd' at exit
This fixes an issue where e.g. failing to initialize the Wayland backend would leave cwd un-free:d
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 02bd7fcd..590e01c0 100644
--- a/main.c
+++ b/main.c
@@ -403,10 +403,10 @@ main(int argc, char *const *argv)
if (!as_server && (term = term_init(
&conf, fdm, reaper, wayl, "foot", cwd, argc, argv,
&term_shutdown_cb, &shutdown_ctx)) == NULL) {
- free(cwd);
goto out;
}
free(cwd);
+ cwd = NULL;
if (as_server && (server = server_init(&conf, fdm, reaper, wayl)) == NULL)
goto out;
@@ -439,6 +439,7 @@ main(int argc, char *const *argv)
ret = aborted || tll_length(wayl->terms) == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
out:
+ free(cwd);
server_destroy(server);
term_destroy(term);