dix: window: use calloc() instead of malloc()
In general safer programming practise to always zero-out newly allocated chunks. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
f16d448722
commit
08cca901d4
10
dix/window.c
10
dix/window.c
|
@ -593,7 +593,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
||||||
pWin->parent = NullWindow;
|
pWin->parent = NullWindow;
|
||||||
SetWindowToDefaults(pWin);
|
SetWindowToDefaults(pWin);
|
||||||
|
|
||||||
pWin->optional = malloc(sizeof(WindowOptRec));
|
pWin->optional = calloc(1, sizeof(WindowOptRec));
|
||||||
if (!pWin->optional)
|
if (!pWin->optional)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -3250,8 +3250,8 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
|
||||||
cm.height = 16;
|
cm.height = 16;
|
||||||
cm.xhot = 8;
|
cm.xhot = 8;
|
||||||
cm.yhot = 8;
|
cm.yhot = 8;
|
||||||
srcbits = malloc(BitmapBytePad(32) * 16);
|
srcbits = calloc(BitmapBytePad(32), 16);
|
||||||
mskbits = malloc(BitmapBytePad(32) * 16);
|
mskbits = calloc(BitmapBytePad(32), 16);
|
||||||
if (!srcbits || !mskbits) {
|
if (!srcbits || !mskbits) {
|
||||||
free(srcbits);
|
free(srcbits);
|
||||||
free(mskbits);
|
free(mskbits);
|
||||||
|
@ -3396,7 +3396,7 @@ MakeWindowOptional(WindowPtr pWin)
|
||||||
|
|
||||||
if (pWin->optional)
|
if (pWin->optional)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
optional = malloc(sizeof(WindowOptRec));
|
optional = calloc(1, sizeof(WindowOptRec));
|
||||||
if (!optional)
|
if (!optional)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
|
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
|
||||||
|
@ -3492,7 +3492,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
|
||||||
if (!pCursor)
|
if (!pCursor)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
pNewNode = malloc(sizeof(DevCursNodeRec));
|
pNewNode = calloc(1, sizeof(DevCursNodeRec));
|
||||||
pNewNode->dev = pDev;
|
pNewNode->dev = pDev;
|
||||||
pNewNode->next = pWin->optional->deviceCursors;
|
pNewNode->next = pWin->optional->deviceCursors;
|
||||||
pWin->optional->deviceCursors = pNewNode;
|
pWin->optional->deviceCursors = pNewNode;
|
||||||
|
|
Loading…
Reference in New Issue