Skip to content

Commit

Permalink
xfixes: calloc, not malloc the cursorScreenRec
Browse files Browse the repository at this point in the history
Debugging NULL pointers is significantly easier than random memory.
Plus, if new fields (such as pointer barriers) are added they may just be
properly initialised.

Signed-off-by: Peter Hutterer <[email protected]>
Reviewed-by: Keith Packard <[email protected]>
  • Loading branch information
whot committed Feb 13, 2011
1 parent d349955 commit c9f7b30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xfixes/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,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);
Expand Down

0 comments on commit c9f7b30

Please sign in to comment.