mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 04:48:02 +02:00
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>
This commit is contained in:
parent
673d946275
commit
2887bb4783
1 changed files with 3 additions and 1 deletions
|
|
@ -114,7 +114,7 @@ static inline struct tap_data *
|
||||||
tap_data_duplicate_sorted(const struct tap_data *src,
|
tap_data_duplicate_sorted(const struct tap_data *src,
|
||||||
int (*cmp)(const void *a, const void *b))
|
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);
|
assert(src->count > 0);
|
||||||
|
|
||||||
|
|
@ -122,6 +122,8 @@ tap_data_duplicate_sorted(const struct tap_data *src,
|
||||||
dest->toffset = src->toffset;
|
dest->toffset = src->toffset;
|
||||||
dest->touches_sz = dest->count;
|
dest->touches_sz = dest->count;
|
||||||
dest->touches = zalloc(dest->count * sizeof(*dest->touches));
|
dest->touches = zalloc(dest->count * sizeof(*dest->touches));
|
||||||
|
assert(dest->touches);
|
||||||
|
|
||||||
memcpy(dest->touches,
|
memcpy(dest->touches,
|
||||||
src->touches,
|
src->touches,
|
||||||
dest->count * sizeof(*dest->touches));
|
dest->count * sizeof(*dest->touches));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue