[PATCH] compositor-drm: free drm_mode in drm_output_destroy

Bryce W. Harrington b.harrington at samsung.com
Mon Dec 16 18:28:22 PST 2013


On Mon, Dec 16, 2013 at 03:23:43PM +0800, Xiong Zhang wrote:
> When drm_output is destroyed, we should free drm_mode to avoid
> memoey leakage.

^ 'memory'

> Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>

Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

> ---
>  src/compositor-drm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index fbf6e49..9af8f8d 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1111,6 +1111,7 @@ drm_output_destroy(struct weston_output *output_base)
>  	struct drm_compositor *c =
>  		(struct drm_compositor *) output->base.compositor;
>  	drmModeCrtcPtr origcrtc = output->original_crtc;
> +	struct drm_mode *drm_mode, *next;
>  
>  	if (output->page_flip_pending) {
>  		output->destroy_pending = 1;
> @@ -1148,6 +1149,12 @@ drm_output_destroy(struct weston_output *output_base)
>  	weston_output_destroy(&output->base);
>  	wl_list_remove(&output->base.link);
>  
> +	wl_list_for_each_safe(drm_mode, next, &output->base.mode_list,
> +			      base.link) {
> +		wl_list_remove(&drm_mode->base.link);
> +		free(drm_mode);
> +	}
> +
>  	free(output);
>  }
>  
> -- 
> 1.8.3.2
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list