Fix memory leak of fallback_output and associated lists

This fixes memory leak of fallback_output because it was never freed
during the shutdown procedure.

This also fixes the memory leaks of lists associated with fallback_output.

This also removes one assertion condition because it was passed by
just setting a pointer reference to null but it left the heap content in place.
This commit is contained in:
Tobias Predel 2023-03-26 12:04:33 +02:00
parent f21090f978
commit a2e415e2e0
3 changed files with 3 additions and 7 deletions

View file

@ -854,9 +854,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wlr_damage_ring_finish(&output->damage_ring); wlr_damage_ring_finish(&output->damage_ring);
output->wlr_output->data = NULL;
output->wlr_output = NULL;
transaction_commit_dirty(); transaction_commit_dirty();
update_output_manager_config(server); update_output_manager_config(server);

View file

@ -285,6 +285,9 @@ void server_fini(struct sway_server *server) {
wl_display_destroy_clients(server->wl_display); wl_display_destroy_clients(server->wl_display);
wl_display_destroy(server->wl_display); wl_display_destroy(server->wl_display);
list_free(server->dirty_nodes); list_free(server->dirty_nodes);
list_free(root->fallback_output->workspaces);
list_free(root->fallback_output->current.workspaces);
free(root->fallback_output);
} }
bool server_start(struct sway_server *server) { bool server_start(struct sway_server *server) {

View file

@ -230,10 +230,6 @@ void output_destroy(struct sway_output *output) {
"Tried to free output which wasn't marked as destroying")) { "Tried to free output which wasn't marked as destroying")) {
return; return;
} }
if (!sway_assert(output->wlr_output == NULL,
"Tried to free output which still had a wlr_output")) {
return;
}
if (!sway_assert(output->node.ntxnrefs == 0, "Tried to free output " if (!sway_assert(output->node.ntxnrefs == 0, "Tried to free output "
"which is still referenced by transactions")) { "which is still referenced by transactions")) {
return; return;