summaryrefslogtreecommitdiff
path: root/dix/cursor.c
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2011-04-04 22:31:42 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2011-04-07 19:57:57 +0300
commit274dca8f2c6707121d45df8015fe7eddb129dec9 (patch)
treea8d7b86449caeaa8c213ffb394535c4221bec050 /dix/cursor.c
parentf603061e9482ad5caf1975ba5395b3294852d072 (diff)
dix: don't free stranger pointers inside AllocARGBCursor
This seems a good convention to follow: if pointers are allocate outside a given function, then free there as well when a failure occurs. AllocARGBCursor and its callers were mixing up the freeing of resources and causing a particular double free inside TileScreenSaver (srcbits and mskbits). Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Diffstat (limited to 'dix/cursor.c')
-rw-r--r--dix/cursor.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/dix/cursor.c b/dix/cursor.c
index 72a7609dc..c191c1e88 100644
--- a/dix/cursor.c
+++ b/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)