summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Weigelt, metux IT consult <info@metux.net>2024-07-31 15:11:27 +0200
committerEnrico Weigelt, metux IT consult <info@metux.net>2024-08-23 13:31:35 +0200
commitb08cb8141b544788d8607fa31e69c089acdb4fa4 (patch)
treed7a947eb014d6cabdc084de79b9c6cc9c18267a9
parent68129d7369f30e1448f587598d3e2c015329ae38 (diff)
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>
-rw-r--r--hw/xnest/Cursor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 285e10ebf..652abd21e 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -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);