sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit ed8c67e2908f0370b8d665ebc09f75e784dafeac
parent fb41371444110949c54d5a60e917a0bb6fa9d366
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 29 Apr 2016 14:08:43 -0400

Merge pull request #615 from neosilky/memleak

Cleaned up some un-free'd memory
Diffstat:
Mcommon/stringop.c | 2+-
Msway/config.c | 8++++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/stringop.c b/common/stringop.c @@ -144,7 +144,7 @@ char **split_args(const char *start, int *argc) { } void free_argv(int argc, char **argv) { - while (--argc > 0) { + while (argc-- > 0) { free(argv[argc]); } free(argv); diff --git a/sway/config.c b/sway/config.c @@ -268,6 +268,7 @@ static char *get_config_path(void) { strcat(config_home, "/.config"); setenv("XDG_CONFIG_HOME", config_home, 1); sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home); + free(config_home); } wordexp_t p; @@ -276,7 +277,8 @@ static char *get_config_path(void) { int i; for (i = 0; i < (int)(sizeof(config_paths) / sizeof(char *)); ++i) { if (wordexp(config_paths[i], &p, 0) == 0) { - path = p.we_wordv[0]; + path = strdup(p.we_wordv[0]); + wordfree(&p); if (file_exists(path)) { return path; } @@ -355,6 +357,8 @@ bool load_main_config(const char *file, bool is_active) { update_active_bar_modifiers(); } + free(path); + return success; } @@ -532,7 +536,7 @@ bool read_config(FILE *file, struct sway_config *config) { default:; } free(line); - free(res); + free_cmd_results(res); } return success;