Skip to content

Commit

Permalink
input-raw: Fix wrong first slot values by using calloc instead of malloc
Browse files Browse the repository at this point in the history
We don't allocate memory often, so this is no performance issue.
And this fixes the case when the driver
doesn't send ABS_MT_SLOT 0 on the first pen-down. We simply start
at slot 0 implicitely and actually should expect to start off with
zeroes in our buffer.
  • Loading branch information
merge committed Apr 24, 2017
1 parent 2997cda commit 47e7ab5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/input-raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ static int ts_input_read_mt(struct tslib_module_info *inf,
return -ENOMEM;

for (j = 0; j < nr; j++) {
i->buf[j] = malloc(max_slots *
i->buf[j] = calloc(max_slots,
sizeof(struct ts_sample_mt));
if (!i->buf[j])
return -ENOMEM;
Expand Down

0 comments on commit 47e7ab5

Please sign in to comment.