mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-29 21:46:40 +00:00
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>
This commit is contained in:
parent
f603061e94
commit
274dca8f2c
3 changed files with 19 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue