From 71a2617c289678648a52c3126fd8f5be88cb26f4 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 10 Apr 2025 18:39:48 +0200 Subject: [PATCH] xfixes: use calloc() instead of malloc() Using calloc() instead of malloc() as preventive measure, so there never can be any hidden bugs or leaks due uninitialized memory. The extra cost of using this compiler intrinsic should be practically impossible to measure - in many cases a good compiler can even deduce if certain areas really don't need to be zero'd (because they're written to right after allocation) and create more efficient machine code. The code pathes in question are pretty cold anyways, so it's probably not worth even thinking about potential extra runtime costs. Signed-off-by: Enrico Weigelt, metux IT consult --- xfixes/cursor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 738d43313..01a6e0863 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -1040,6 +1040,8 @@ XFixesCursorInit(void) for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; CursorScreenPtr cs = GetCursorScreen(pScreen); + if (!cs) + return FALSE; dixScreenHookClose(pScreen, CursorScreenClose); Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor); cs->pCursorHideCounts = NULL;