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
Backport-Of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1652
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1653>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-31 15:11:27 +02:00
parent 68129d7369
commit b08cb8141b

View file

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