[PATCH xserver 9/9] xfixes: avoid double free if AddResource fails

Julien Cristau jcristau at debian.org
Mon Mar 7 22:20:34 UTC 2016


pChc is already freed through CursorFreeHideCount →
deleteCursorHideCount.

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 xfixes/cursor.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 5619aad..10f9b23 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;
 }
-- 
2.7.0



More information about the xorg-devel mailing list