[PATCH 1/4] compositor-drm: Fix memory leak in update_outputs

Kristian Høgsberg krh at bitplanet.net
Thu Dec 8 10:32:37 PST 2011


On Thu, Dec 8, 2011 at 11:05 AM, David Herrmann
<dh.herrmann at googlemail.com> wrote:
> We need to correctly free every connector we retrieve. We currently loose them
> if they are not connected.

Thanks, all of these look good and have been committed.
Kristian

> 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