diff options
Diffstat (limited to 'xorg-server/dbe')
-rw-r--r-- | xorg-server/dbe/dbe.c | 14 | ||||
-rw-r--r-- | xorg-server/dbe/midbe.c | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/xorg-server/dbe/dbe.c b/xorg-server/dbe/dbe.c index c19f4a47f..49a3f35b7 100644 --- a/xorg-server/dbe/dbe.c +++ b/xorg-server/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; } diff --git a/xorg-server/dbe/midbe.c b/xorg-server/dbe/midbe.c index 8f759107a..9684d45bd 100644 --- a/xorg-server/dbe/midbe.c +++ b/xorg-server/dbe/midbe.c @@ -87,7 +87,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo * pScrVisInfo) } /* Allocate an array of XdbeVisualInfo items. */ - if (!(visInfo = (XdbeVisualInfo *) malloc(count * sizeof(XdbeVisualInfo)))) { + if (!(visInfo = xallocarray(count, sizeof(XdbeVisualInfo)))) { return FALSE; /* memory alloc failure */ } |