Don't access event buffer after realloc
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 24 Dec 2013 03:46:20 +0000 (13:46 +1000)
committerJonas Ådahl <jadahl@gmail.com>
Tue, 7 Jan 2014 20:27:30 +0000 (21:27 +0100)
realloc() may free the original event buffer, don't access it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput.c

index 989fd8c..95976f7 100644 (file)
@@ -887,7 +887,7 @@ libinput_post_event(struct libinput *libinput,
                        move_len = libinput->events_len - libinput->events_out;
                        new_out = events_len - move_len;
                        memmove(events + new_out,
-                               libinput->events + libinput->events_out,
+                               events + libinput->events_out,
                                move_len * sizeof *events);
                        libinput->events_out = new_out;
                }