From e69c7fd6840e7e18061c7dfee1197e60e919bddb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 9 Jan 2018 11:48:10 -0500 Subject: animcur: Handle allocation failure for the animation timer Signed-off-by: Adam Jackson Reviewed-by: Aaron Plattner Tested-by: Aaron Plattner (cherry picked from commit 4d82a150b2ee29c1025408cdb9ece255452a81bd) --- render/animcur.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'render') diff --git a/render/animcur.c b/render/animcur.c index e585a8f23..5ed929e73 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -302,7 +302,7 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid) { CursorPtr pCursor; - int rc, i; + int rc = BadAlloc, i; AnimCurPtr ac; for (i = 0; i < screenInfo.numScreens; i++) @@ -317,7 +317,7 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, sizeof(AnimCurRec) + ncursor * sizeof(AnimCurElt), 1); if (!pCursor) - return BadAlloc; + return rc; dixInitPrivates(pCursor, pCursor + 1, PRIVATE_CURSOR); pCursor->bits = &animCursorBits; pCursor->refcnt = 1; @@ -336,8 +336,10 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, ac->timer = TimerSet(NULL, 0, 0, AnimCurTimerNotify, NULL); /* security creation/labeling check */ - rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, - RT_NONE, NULL, DixCreateAccess); + if (ac->timer) + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, + RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { TimerFree(ac->timer); dixFiniPrivates(pCursor, PRIVATE_CURSOR); -- cgit v1.2.3