Creating a key binding which replaces itself (such as "bind x bind x lsw")

frees the command list bound to the key while it is still being executed,
leading to a use after free. To prevent this, create a dead keys list and defer
freeing replaced or removed key bindings until the main loop when the key
binding will have finished executing.

Found by Johan Friis when creating a key binding to reload his configuration
file.
This commit is contained in:
Nicholas Marriott
2009-07-12 17:33:18 +00:00
parent 22d51ec1ea
commit 9e49ec6cd3
2 changed files with 24 additions and 8 deletions

View File

@ -346,6 +346,9 @@ server_main(int srv_fd)
server_handle_windows(&pfd);
server_handle_clients(&pfd);
/* Collect any unset key bindings. */
key_bindings_clean();
/*
* If we have no sessions and clients left, let's get out
* of here...