summaryrefslogtreecommitdiff
path: root/render
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 /render
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 'render')
-rw-r--r--render/render.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/render/render.c b/render/render.c
index c5da6d78f..ebb1d630a 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1705,11 +1705,17 @@ ProcRenderCreateCursor (ClientPtr client)
GetColor(twocolor[1], 0),
&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;
}
static int