[PATCH] xfree86: don't access the old input handler after freeing it

David Airlie airlied at redhat.com
Tue Jan 8 20:53:27 PST 2013


> Subject: [PATCH] xfree86: don't access the old input handler after freeing it
> 
> Introduced in 323869f3298cbbfe864af9404a8aed1bf7995d79
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Reviewed-by: Dave Airlie <airlied at redhat.com>
> ---
>  hw/xfree86/common/xf86Events.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Events.c
> b/hw/xfree86/common/xf86Events.c
> index d8d4fad..377e936 100644
> --- a/hw/xfree86/common/xf86Events.c
> +++ b/hw/xfree86/common/xf86Events.c
> @@ -619,14 +619,16 @@ InputHandlerProc
>  xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
>  {
>      static IHPtr handler = NULL;
> -    IHPtr old_handler = handler;
> +    InputHandlerProc old_proc = NULL;
>  
> -    if (old_handler)
> -        xf86RemoveGeneralHandler(old_handler);
> +    if (handler) {
> +        old_proc = handler->ihproc;
> +        xf86RemoveGeneralHandler(handler);
> +    }
>  
>      handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
>  
> -    return (old_handler) ? old_handler->ihproc : NULL;
> +    return old_proc;
>  }
>  
>  static void
> --
> 1.8.1
> 
> 


More information about the xorg-devel mailing list