Xnest: cursor: fix potentially uninitialized memory

It's safer to zero-out the cursor-private memory on allocation,
instead of relying on being cleared initialized somewhere later.

Fixes: 3f3ff971ec - Replace X-allocation functions with their C89 counterparts
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1652>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-31 15:11:27 +02:00 committed by Marge Bot
parent f26f17c66a
commit 8d5584558f

View File

@ -99,7 +99,7 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
bg_color.green = pCursor->backGreen; bg_color.green = pCursor->backGreen;
bg_color.blue = pCursor->backBlue; bg_color.blue = pCursor->backBlue;
xnestSetCursorPriv(pCursor, pScreen, malloc(sizeof(xnestPrivCursor))); xnestSetCursorPriv(pCursor, pScreen, calloc(1, sizeof(xnestPrivCursor)));
xnestCursor(pCursor, pScreen) = xnestCursor(pCursor, pScreen) =
XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color, XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
pCursor->bits->xhot, pCursor->bits->yhot); pCursor->bits->xhot, pCursor->bits->yhot);