touchpad: check calloc result
authorCarlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Mon, 28 Apr 2014 23:26:28 +0000 (01:26 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 30 Apr 2014 03:24:27 +0000 (13:24 +1000)
Check the value returned by calloc.

Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad.c

index 63553643a5f18d78295e022484c13ba3d493a13a..109441d2a6e69931a4b2aba87e6d4b8b6a1c5141 100644 (file)
@@ -721,6 +721,8 @@ tp_init_slots(struct tp_dispatch *tp,
        }
        tp->touches = calloc(tp->ntouches,
                             sizeof(struct tp_touch));
+       if (!tp->touches)
+               return -1;
 
        return 0;
 }