xfixes: avoid double free if AddResource fails

pChc is already freed through CursorFreeHideCount →
deleteCursorHideCount.

Reviewed-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Julien Cristau 2016-03-07 23:20:34 +01:00 committed by Adam Jackson
parent 4217db89ec
commit 2be527b1d4
1 changed files with 1 additions and 3 deletions

View File

@ -774,10 +774,8 @@ createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
if (!AddResource(pChc->resource, CursorHideCountType, (void *) pChc)) {
free(pChc);
if (!AddResource(pChc->resource, CursorHideCountType, (void *) pChc))
return BadAlloc;
}
return Success;
}