dix: protect ChangeWindowDeviceCursor() from allocation failure
On memory allocation failure, return BadAlloc instead of crashing. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
8b079ed198
commit
7b7579e956
|
@ -3486,17 +3486,17 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
|
|||
}
|
||||
else {
|
||||
/* no device cursor yet */
|
||||
DevCursNodePtr pNewNode;
|
||||
|
||||
if (!pCursor)
|
||||
return Success;
|
||||
|
||||
pNewNode = malloc(sizeof(DevCursNodeRec));
|
||||
DevCursNodePtr pNewNode = calloc(1, sizeof(DevCursNodeRec));
|
||||
if (!pNewNode)
|
||||
return BadAlloc;
|
||||
|
||||
pNewNode->dev = pDev;
|
||||
pNewNode->next = pWin->optional->deviceCursors;
|
||||
pWin->optional->deviceCursors = pNewNode;
|
||||
pNode = pNewNode;
|
||||
|
||||
}
|
||||
|
||||
if (pCursor && WindowParentHasDeviceCursor(pWin, pDev, pCursor))
|
||||
|
|
Loading…
Reference in New Issue