seat: Plug leak of deactivated fds
Only if a device had an fd and was active would an fd be closed. As devices are deactivated early on session switch, this lead to fd leakage. Close fds regardless of active state.
This commit is contained in:
parent
51c7467516
commit
8cb076d0a4
1 changed files with 16 additions and 17 deletions
|
@ -309,13 +309,12 @@ int seat_close_device(struct client *client, struct seat_device *seat_device) {
|
|||
|
||||
seat_device->ref_cnt--;
|
||||
if (seat_device->ref_cnt > 0) {
|
||||
// We still have more references to this device, so leave it be.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The ref count hit zero, so destroy the device
|
||||
linked_list_remove(&seat_device->link);
|
||||
if (seat_device->active && seat_device->fd != -1) {
|
||||
if (seat_device->fd != -1) {
|
||||
if (seat_device->active) {
|
||||
switch (seat_device->type) {
|
||||
case SEAT_DEVICE_TYPE_DRM:
|
||||
if (drm_drop_master(seat_device->fd) == -1) {
|
||||
|
@ -331,8 +330,8 @@ int seat_close_device(struct client *client, struct seat_device *seat_device) {
|
|||
log_error("invalid seat device type");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
close(seat_device->fd);
|
||||
seat_device->fd = -1;
|
||||
}
|
||||
free(seat_device->path);
|
||||
free(seat_device);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue