aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/cursor.c5
-rw-r--r--xorg-server/dix/dispatch.c12
2 files changed, 10 insertions, 7 deletions
diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c
index acd118a1c..4d5d51619 100644
--- a/xorg-server/dix/cursor.c
+++ b/xorg-server/dix/cursor.c
@@ -241,11 +241,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
*ppCurs = NULL;
pCurs = (CursorPtr)calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
if (!pCurs)
- {
- free(psrcbits);
- free(pmaskbits);
return BadAlloc;
- }
+
bits = (CursorBitsPtr)((char *)pCurs + CURSOR_REC_SIZE);
dixInitPrivates(pCurs, pCurs + 1, PRIVATE_CURSOR);
dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS)
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index 5e1c858b6..14775c35c 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -3017,11 +3017,17 @@ ProcCreateCursor (ClientPtr client)
&pCursor, client, stuff->cid);
if (rc != Success)
- return rc;
- if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
- return BadAlloc;
+ goto bail;
+ if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) {
+ rc = BadAlloc;
+ goto bail;
+ }
return Success;
+bail:
+ free(srcbits);
+ free(mskbits);
+ return rc;
}
int