summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-06-19 12:15:54 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-06-19 12:16:23 +1000
commit2887bb478354724f2d3898a5299f3d2755d2f09d (patch)
treecbff2b3d6bae31d50923dc185aea707ac24e267d
parent673d946275fdd82959b18ef1f318925f0d070b21 (diff)
tools: assert on malloc failure
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>
-rw-r--r--tools/libinput-measure-touchpad-tap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/libinput-measure-touchpad-tap.c b/tools/libinput-measure-touchpad-tap.c
index 6b8499c..6064d61 100644
--- a/tools/libinput-measure-touchpad-tap.c
+++ b/tools/libinput-measure-touchpad-tap.c
@@ -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));