Merge pull request #2091 from martinetd/config-block-use-after-free

sway/config: fix use-after-free for end of block
This commit is contained in:
Drew DeVault 2018-06-02 08:39:14 -07:00 committed by GitHub
commit 5b72e8606c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -626,13 +626,13 @@ bool read_config(FILE *file, struct sway_config *config) {
success = false; success = false;
break; break;
} }
wlr_log(L_DEBUG, "Exiting block '%s'", block);
list_del(stack, 0);
free(block);
if (strcmp(block, "bar") == 0) { if (strcmp(block, "bar") == 0) {
config->current_bar = NULL; config->current_bar = NULL;
} }
wlr_log(L_DEBUG, "Exiting block '%s'", block);
list_del(stack, 0);
free(block);
memset(&config->handler_context, 0, memset(&config->handler_context, 0,
sizeof(config->handler_context)); sizeof(config->handler_context));
default:; default:;