summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-01-09 13:58:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-01-11 14:57:48 +1000
commitf4a58469a298c226668fd8dce375bf22331c902d (patch)
treec49da86dee9f29e9bd65a07552fb1b37df6c90d8
parent205cfbd6d9824fb9a67c21b19bc8f1e66c9df4d2 (diff)
xfree86: don't access the old input handler after freeing it
Introduced in 323869f3298cbbfe864af9404a8aed1bf7995d79 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--hw/xfree86/common/xf86Events.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index d8d4fad9c..377e936f7 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