drm-backend: free old connector props before replacing it with newer data

In commit c1e89ba2 "compositor-drm: move connector fields into
drm_head" the function drm_head_assign_connector_info() was
introduced. By that time it was being used only at drm_head
creation, and not to handle connector changes.

In d2e6242e "compositor-drm: create heads for all connectors"
it started to be used also to handle connector changes. In
this scenario we replace old connector props with newer data.
Before doing this, free the old connector data to avoid memory
leak.

Note that as drm_property_info_free() is safe to be called on
a zero-initialized struct, we can call it even in the case where
the head is being created and there are no props yet.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 4 years ago committed by Pekka Paalanen
parent 3d6721eb15
commit bb33f90658
  1. 1
      libweston/backend-drm/drm.c

@ -2021,6 +2021,7 @@ drm_head_assign_connector_info(struct drm_head *head,
drmModeFreeConnector(head->connector);
head->connector = connector;
drm_property_info_free(head->props_conn, WDRM_CONNECTOR__COUNT);
drm_property_info_populate(head->backend, connector_props,
head->props_conn,
WDRM_CONNECTOR__COUNT, props);

Loading…
Cancel
Save