tools: assert on malloc failure
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 19 Jun 2017 02:15:54 +0000 (12:15 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 19 Jun 2017 02:16:23 +0000 (12:16 +1000)
No need for proper recovery here in this debugging tool.
Also sneak in a whitespace fix while we're here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools/libinput-measure-touchpad-tap.c

index 6b8499c359d93245ba5b74585e0c507cb266a889..6064d61e6cb885899c3ede29000acd369a48a99f 100644 (file)
@@ -114,7 +114,7 @@ static inline struct tap_data *
 tap_data_duplicate_sorted(const struct tap_data *src,
                          int (*cmp)(const void *a, const void *b))
 {
-       struct tap_data *dest= tap_data_new();
+       struct tap_data *dest = tap_data_new();
 
        assert(src->count > 0);
 
@@ -122,6 +122,8 @@ tap_data_duplicate_sorted(const struct tap_data *src,
        dest->toffset = src->toffset;
        dest->touches_sz = dest->count;
        dest->touches = zalloc(dest->count * sizeof(*dest->touches));
+       assert(dest->touches);
+
        memcpy(dest->touches,
               src->touches,
               dest->count * sizeof(*dest->touches));