kms: Fix drmModeEncoder leak

The result of drmModeGetEncoder() needs to be free'd by the caller.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1020
This commit is contained in:
Sebastian Keller 2020-01-24 18:51:03 +01:00 committed by Georges Basile Stavracas Neto
parent 66fe6d85d0
commit abc58f7b9d

View File

@ -381,8 +381,11 @@ set_encoder_device_idx_bit (uint32_t *encoder_device_idxs,
if (drm_encoder->encoder_id == encoder_id) if (drm_encoder->encoder_id == encoder_id)
{ {
*encoder_device_idxs |= (1 << i); *encoder_device_idxs |= (1 << i);
drmModeFreeEncoder (drm_encoder);
break; break;
} }
drmModeFreeEncoder (drm_encoder);
} }
} }
@ -421,6 +424,8 @@ state_set_crtc_state (MetaKmsConnectorState *state,
if (drm_connector->encoder_id == drm_encoder->encoder_id) if (drm_connector->encoder_id == drm_encoder->encoder_id)
state->current_crtc_id = drm_encoder->crtc_id; state->current_crtc_id = drm_encoder->crtc_id;
drmModeFreeEncoder (drm_encoder);
} }
state->common_possible_crtcs = common_possible_crtcs; state->common_possible_crtcs = common_possible_crtcs;