[PATCH 1/4] compositor-drm: Fix memory leak in update_outputs
David Herrmann
dh.herrmann at googlemail.com
Thu Dec 8 08:05:43 PST 2011
We need to correctly free every connector we retrieve. We currently loose them
if they are not connected.
Signed-off-by: David Herrmann <dh.herrmann at googlemail.com>
---
compositor/compositor-drm.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c
index 855a811..9f76187 100644
--- a/compositor/compositor-drm.c
+++ b/compositor/compositor-drm.c
@@ -609,9 +609,13 @@ update_outputs(struct drm_compositor *ec)
int connector_id = resources->connectors[i];
connector = drmModeGetConnector(ec->drm.fd, connector_id);
- if (connector == NULL ||
- connector->connection != DRM_MODE_CONNECTED)
+ if (connector == NULL)
+ continue;
+
+ if (connector->connection != DRM_MODE_CONNECTED) {
+ drmModeFreeConnector(connector);
continue;
+ }
connected |= (1 << connector_id);
--
1.7.8
More information about the wayland-devel
mailing list