dri: ProcXF86DRIGetDrawableInfo() allocate temporary buffer on stack
No need for going through heap, stack is also fine. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
c704eb884a
commit
32f6a22dd1
|
@ -361,7 +361,7 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
};
|
};
|
||||||
DrawablePtr pDrawable;
|
DrawablePtr pDrawable;
|
||||||
int X, Y, W, H;
|
int X, Y, W, H;
|
||||||
drm_clip_rect_t *pClipRects, *pClippedRects = NULL;
|
drm_clip_rect_t *pClipRects;
|
||||||
drm_clip_rect_t *pBackClipRects;
|
drm_clip_rect_t *pBackClipRects;
|
||||||
int backX, backY, rc;
|
int backX, backY, rc;
|
||||||
|
|
||||||
|
@ -405,12 +405,10 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
if (rep.numBackClipRects)
|
if (rep.numBackClipRects)
|
||||||
rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
|
rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
|
||||||
|
|
||||||
|
drm_clip_rect_t pClippedRects[rep.numClipRects];
|
||||||
|
|
||||||
if (rep.numClipRects) {
|
if (rep.numClipRects) {
|
||||||
/* Clip cliprects to screen dimensions (redirected windows) */
|
/* Clip cliprects to screen dimensions (redirected windows) */
|
||||||
pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t));
|
|
||||||
|
|
||||||
if (!pClippedRects)
|
|
||||||
return BadAlloc;
|
|
||||||
|
|
||||||
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
|
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -441,7 +439,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
WriteToClient(client,
|
WriteToClient(client,
|
||||||
sizeof(drm_clip_rect_t) * rep.numClipRects,
|
sizeof(drm_clip_rect_t) * rep.numClipRects,
|
||||||
pClippedRects);
|
pClippedRects);
|
||||||
free(pClippedRects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep.numBackClipRects) {
|
if (rep.numBackClipRects) {
|
||||||
|
|
Loading…
Reference in New Issue