From 2be527b1d4ce2b0412c4484539a8c9607645ec6d Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Mon, 7 Mar 2016 23:20:34 +0100 Subject: [PATCH] xfixes: avoid double free if AddResource fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pChc is already freed through CursorFreeHideCount → deleteCursorHideCount. Reviewed-by: Rémi Cardona Signed-off-by: Julien Cristau --- xfixes/cursor.c | 4 +--- 1 file changed, 1 insertion(+), 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; }