mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-06-03 21:48:21 +02:00
util: check for NULL on realloc in _infmask_ensure_size
And abort if that ever happens because it really shouldn't. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1465>
This commit is contained in:
parent
aa04f67b1c
commit
e32202eeae
1 changed files with 2 additions and 0 deletions
|
|
@ -260,6 +260,8 @@ _nonnull_(1) static inline void _infmask_ensure_size(infmask_t *mask, unsigned i
|
|||
size_t required = _infmask_size_for_bit(bit);
|
||||
if (required > mask->nmasks) {
|
||||
mask->mask = realloc(mask->mask, required * sizeof(bitmask_t));
|
||||
if (!mask->mask)
|
||||
abort();
|
||||
/* Zero out the new memory */
|
||||
for (size_t i = mask->nmasks; i < required; i++)
|
||||
mask->mask[i] = bitmask_new();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue