summaryrefslogtreecommitdiff
path: root/xfixes
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2016-03-07 23:20:34 +0100
committerAdam Jackson <ajax@redhat.com>2016-03-08 10:20:15 -0500
commit2be527b1d4ce2b0412c4484539a8c9607645ec6d (patch)
tree7c2d2563f35d32af825d2ad3fea0fe6b1030a90d /xfixes
parent4217db89ecd480fda2ee74fecba06c6713c2a0f0 (diff)
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>
Diffstat (limited to 'xfixes')
-rw-r--r--xfixes/cursor.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 5619aad2e..10f9b2346 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -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;
}