diff options
Diffstat (limited to 'xorg-server/xkb/XKBAlloc.c')
-rw-r--r-- | xorg-server/xkb/XKBAlloc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xorg-server/xkb/XKBAlloc.c b/xorg-server/xkb/XKBAlloc.c index 78c98371d..18557b804 100644 --- a/xorg-server/xkb/XKBAlloc.c +++ b/xorg-server/xkb/XKBAlloc.c @@ -56,8 +56,8 @@ XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI) if (compat->sym_interpret == NULL) compat->num_si = 0; prev_interpret = compat->sym_interpret; - compat->sym_interpret = realloc(compat->sym_interpret, - nSI * sizeof(XkbSymInterpretRec)); + compat->sym_interpret = reallocarray(compat->sym_interpret, + nSI, sizeof(XkbSymInterpretRec)); if (compat->sym_interpret == NULL) { free(prev_interpret); compat->size_si = compat->num_si = 0; @@ -159,9 +159,9 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) else if (nTotalAliases > names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; - names->key_aliases = realloc(names->key_aliases, - nTotalAliases * - sizeof(XkbKeyAliasRec)); + names->key_aliases = reallocarray(names->key_aliases, + nTotalAliases, + sizeof(XkbKeyAliasRec)); if (names->key_aliases != NULL) { memset(&names->key_aliases[names->num_key_aliases], 0, (nTotalAliases - @@ -184,8 +184,8 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) else if (nTotalRG > names->num_rg) { Atom *prev_radio_groups = names->radio_groups; - names->radio_groups = realloc(names->radio_groups, - nTotalRG * sizeof(Atom)); + names->radio_groups = reallocarray(names->radio_groups, + nTotalRG, sizeof(Atom)); if (names->radio_groups != NULL) { memset(&names->radio_groups[names->num_rg], 0, (nTotalRG - names->num_rg) * sizeof(Atom)); |