summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-07-15 22:09:04 +0100
committerLibravatar GitHub <noreply@github.com>2018-07-15 22:09:04 +0100
commitb314a8f2cc792aa59d8f12e5adb9aed2967af646 (patch)
tree74468af2643af7ad9315fb983acad8b8f69f8c4b
parentMerge pull request #2277 from ianyfan/config-read-fix (diff)
parentconfig output: free command string if unused (diff)
downloadsway-b314a8f2cc792aa59d8f12e5adb9aed2967af646.tar.gz
sway-b314a8f2cc792aa59d8f12e5adb9aed2967af646.tar.zst
sway-b314a8f2cc792aa59d8f12e5adb9aed2967af646.zip
Merge pull request #2280 from ianyfan/leaks
Fix some memory leaks
-rw-r--r--sway/commands/bar/position.c1
-rw-r--r--sway/config.c1
-rw-r--r--sway/config/output.c2
3 files changed, 4 insertions, 0 deletions
diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c
index 48e7ddbd..44bb4ae3 100644
--- a/sway/commands/bar/position.c
+++ b/sway/commands/bar/position.c
@@ -17,6 +17,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
17 if (strcasecmp(valid[i], argv[0]) == 0) { 17 if (strcasecmp(valid[i], argv[0]) == 0) {
18 wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s", 18 wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s",
19 argv[0], config->current_bar->id); 19 argv[0], config->current_bar->id);
20 free(config->current_bar->position);
20 config->current_bar->position = strdup(argv[0]); 21 config->current_bar->position = strdup(argv[0]);
21 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 22 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
22 } 23 }
diff --git a/sway/config.c b/sway/config.c
index 2c051146..f63835bf 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -474,6 +474,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
474 list_del(config->config_chain, index); 474 list_del(config->config_chain, index);
475 return false; 475 return false;
476 } 476 }
477 free(real_path);
477 478
478 // restore current_config_path 479 // restore current_config_path
479 config->current_config_path = parent_config; 480 config->current_config_path = parent_config;
diff --git a/sway/config/output.c b/sway/config/output.c
index 205e2633..1bf9e5f1 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -207,6 +207,8 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
207 output->sway_output->bg_pid = fork(); 207 output->sway_output->bg_pid = fork();
208 if (output->sway_output->bg_pid == 0) { 208 if (output->sway_output->bg_pid == 0) {
209 execvp(cmd[0], cmd); 209 execvp(cmd[0], cmd);
210 } else {
211 free(command);
210 } 212 }
211 } 213 }
212 if (oc && oc->dpms_state != DPMS_IGNORE) { 214 if (oc && oc->dpms_state != DPMS_IGNORE) {