diff options
Diffstat (limited to 'xserver/dbe/dbe.c')
-rw-r--r-- | xserver/dbe/dbe.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xserver/dbe/dbe.c b/xserver/dbe/dbe.c index e5d928d7b..23f7e164d 100644 --- a/xserver/dbe/dbe.c +++ b/xserver/dbe/dbe.c @@ -287,11 +287,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client) } /* malloc/realloc a new array and initialize all elements to 0. */ - pDbeWindowPriv->IDs = (XID *) realloc(pIDs, - (pDbeWindowPriv-> - maxAvailableIDs + - DBE_INCR_MAX_IDS) * - sizeof(XID)); + pDbeWindowPriv->IDs = + reallocarray(pIDs, + pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS, + sizeof(XID)); if (!pDbeWindowPriv->IDs) { return BadAlloc; } @@ -470,7 +469,7 @@ ProcDbeSwapBuffers(ClientPtr client) dbeSwapInfo = (xDbeSwapInfo *) &stuff[1]; /* Allocate array to record swap information. */ - swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec)); + swapInfo = xallocarray(nStuff, sizeof(DbeSwapInfoRec)); if (swapInfo == NULL) { return BadAlloc; } @@ -580,8 +579,7 @@ ProcDbeGetVisualInfo(ClientPtr client) return BadAlloc; /* Make sure any specified drawables are valid. */ if (stuff->n != 0) { - if (!(pDrawables = (DrawablePtr *) malloc(stuff->n * - sizeof(DrawablePtr)))) { + if (!(pDrawables = xallocarray(stuff->n, sizeof(DrawablePtr)))) { return BadAlloc; } |