dri: report failed memory allocation

ProcXF86DRIGetDrawableInfo() should report failed memory allocation instead
of pretending everything's okay.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1797>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-18 18:33:40 +02:00 committed by Marge Bot
parent 2539ddae50
commit 94d942267a

View File

@ -425,7 +425,9 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
/* Clip cliprects to screen dimensions (redirected windows) */ /* Clip cliprects to screen dimensions (redirected windows) */
pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t)); pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t));
if (pClippedRects) { if (!pClippedRects)
return BadAlloc;
ScreenPtr pScreen = screenInfo.screens[stuff->screen]; ScreenPtr pScreen = screenInfo.screens[stuff->screen];
int i, j; int i, j;
@ -442,11 +444,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
} }
rep.numClipRects = j; rep.numClipRects = j;
}
else {
rep.numClipRects = 0;
}
rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects; rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
} }