[PATCH xinput] Fix XRRCrtcInfo memory leaks

Aaron Plattner aplattner at nvidia.com
Wed Feb 8 08:03:35 PST 2012


On 02/08/2012 06:05 AM, Peter Hutterer wrote:
> Reported-by: Aaron Plattner<aplattner at nvidia.com>
> Signed-off-by: Peter Hutterer<peter.hutterer at who-t.net>
> ---
>   src/transform.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/src/transform.c b/src/transform.c
> index cffc3af..2440b64 100644
> --- a/src/transform.c
> +++ b/src/transform.c
> @@ -158,6 +158,7 @@ map_output_xrandr(Display *dpy, int deviceid, const char *output_name)
>               found = 1;
>               break;
>           }
> +        XRRFreeCrtcInfo(crtc_info);

crtc_info isn't used until the if (found) check below; maybe it would be 
easier to move the XRRGetCrtcInfo call into there.

>       }
>
>       /* crtc holds our screen info, need to compare to actual screen size */
> @@ -168,6 +169,7 @@ map_output_xrandr(Display *dpy, int deviceid, const char *output_name)
>           set_transformation_matrix(dpy,&m, crtc_info->x, crtc_info->y,
>                                     crtc_info->width, crtc_info->height);
>           rc = apply_matrix(dpy, deviceid,&m);
> +        XRRFreeCrtcInfo(crtc_info);
>       } else
>           printf("Unable to find output '%s'. "
>                   "Output may not be connected.\n", output_name);



More information about the xorg-devel mailing list