diff options
Diffstat (limited to 'xserver/hw/xfree86/common/xf86Bus.c')
-rw-r--r-- | xserver/hw/xfree86/common/xf86Bus.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xserver/hw/xfree86/common/xf86Bus.c b/xserver/hw/xfree86/common/xf86Bus.c index ad255aeed..2b412fa2f 100644 --- a/xserver/hw/xfree86/common/xf86Bus.c +++ b/xserver/hw/xfree86/common/xf86Bus.c @@ -256,11 +256,11 @@ int xf86AllocateEntity(void) { xf86NumEntities++; - xf86Entities = xnfrealloc(xf86Entities, - sizeof(EntityPtr) * xf86NumEntities); + xf86Entities = xnfreallocarray(xf86Entities, + xf86NumEntities, sizeof(EntityPtr)); xf86Entities[xf86NumEntities - 1] = xnfcalloc(1, sizeof(EntityRec)); xf86Entities[xf86NumEntities - 1]->entityPrivates = - xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1); + xnfcalloc(xf86EntityPrivateCount, sizeof(DevUnion)); return xf86NumEntities - 1; } @@ -326,12 +326,13 @@ xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex) } pScrn->numEntities++; - pScrn->entityList = xnfrealloc(pScrn->entityList, - pScrn->numEntities * sizeof(int)); + pScrn->entityList = xnfreallocarray(pScrn->entityList, + pScrn->numEntities, sizeof(int)); pScrn->entityList[pScrn->numEntities - 1] = entityIndex; xf86Entities[entityIndex]->inUse = TRUE; - pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList, - pScrn->numEntities * sizeof(int)); + pScrn->entityInstanceList = xnfreallocarray(pScrn->entityInstanceList, + pScrn->numEntities, + sizeof(int)); pScrn->entityInstanceList[pScrn->numEntities - 1] = 0; } @@ -427,8 +428,8 @@ xf86AddDevToEntity(int entityIndex, GDevPtr dev) pEnt = xf86Entities[entityIndex]; pEnt->numInstances++; - pEnt->devices = xnfrealloc(pEnt->devices, - pEnt->numInstances * sizeof(GDevPtr)); + pEnt->devices = xnfreallocarray(pEnt->devices, + pEnt->numInstances, sizeof(GDevPtr)); pEnt->devices[pEnt->numInstances - 1] = dev; dev->claimed = TRUE; } @@ -670,8 +671,8 @@ xf86AllocateEntityPrivateIndex(void) idx = xf86EntityPrivateCount++; for (i = 0; i < xf86NumEntities; i++) { pEnt = xf86Entities[i]; - nprivs = xnfrealloc(pEnt->entityPrivates, - xf86EntityPrivateCount * sizeof(DevUnion)); + nprivs = xnfreallocarray(pEnt->entityPrivates, + xf86EntityPrivateCount, sizeof(DevUnion)); /* Zero the new private */ memset(&nprivs[idx], 0, sizeof(DevUnion)); pEnt->entityPrivates = nprivs; |