mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
Merge pull request #615 from neosilky/memleak
Cleaned up some un-free'd memory
This commit is contained in:
commit
ed8c67e290
2 changed files with 7 additions and 3 deletions
|
@ -144,7 +144,7 @@ char **split_args(const char *start, int *argc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_argv(int argc, char **argv) {
|
void free_argv(int argc, char **argv) {
|
||||||
while (--argc > 0) {
|
while (argc-- > 0) {
|
||||||
free(argv[argc]);
|
free(argv[argc]);
|
||||||
}
|
}
|
||||||
free(argv);
|
free(argv);
|
||||||
|
|
|
@ -268,6 +268,7 @@ static char *get_config_path(void) {
|
||||||
strcat(config_home, "/.config");
|
strcat(config_home, "/.config");
|
||||||
setenv("XDG_CONFIG_HOME", config_home, 1);
|
setenv("XDG_CONFIG_HOME", config_home, 1);
|
||||||
sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
|
sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
|
||||||
|
free(config_home);
|
||||||
}
|
}
|
||||||
|
|
||||||
wordexp_t p;
|
wordexp_t p;
|
||||||
|
@ -276,7 +277,8 @@ static char *get_config_path(void) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int)(sizeof(config_paths) / sizeof(char *)); ++i) {
|
for (i = 0; i < (int)(sizeof(config_paths) / sizeof(char *)); ++i) {
|
||||||
if (wordexp(config_paths[i], &p, 0) == 0) {
|
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)) {
|
if (file_exists(path)) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -355,6 +357,8 @@ bool load_main_config(const char *file, bool is_active) {
|
||||||
update_active_bar_modifiers();
|
update_active_bar_modifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +536,7 @@ bool read_config(FILE *file, struct sway_config *config) {
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
free(line);
|
free(line);
|
||||||
free(res);
|
free_cmd_results(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
Loading…
Reference in a new issue