[PATCH] xfixes: calloc, not malloc the cursorScreenRec
Peter Hutterer
peter.hutterer at who-t.net
Thu Feb 10 20:44:48 PST 2011
Debugging NULL pointers is significantly easier than random memory.
Plus, if new fields (such as for pointer barriers) are added they may just
be properly initialised.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
xfixes/cursor.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index a83d0a1..1d03cd3 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1244,7 +1244,7 @@ XFixesCursorInit (void)
ScreenPtr pScreen = screenInfo.screens[i];
CursorScreenPtr cs;
- cs = (CursorScreenPtr) malloc(sizeof (CursorScreenRec));
+ cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs)
return FALSE;
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
--
1.7.3.5
More information about the xorg-devel
mailing list