mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +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) {
|
||||
while (--argc > 0) {
|
||||
while (argc-- > 0) {
|
||||
free(argv[argc]);
|
||||
}
|
||||
free(argv);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue