bar: free old position when changing

This commit is contained in:
Ian Fan 2018-07-15 21:47:22 +01:00
parent 87334dbccb
commit ba8981e44b

View File

@ -17,6 +17,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
if (strcasecmp(valid[i], argv[0]) == 0) { if (strcasecmp(valid[i], argv[0]) == 0) {
wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s", wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s",
argv[0], config->current_bar->id); argv[0], config->current_bar->id);
free(config->current_bar->position);
config->current_bar->position = strdup(argv[0]); config->current_bar->position = strdup(argv[0]);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }