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

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


ms_dri2_frame_event_client_gone or ms_dri2_frame_event_drawable_gone
already free the resource.

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

diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
index 0fe420c..83cb3e0 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -97,10 +97,8 @@ ms_get_resource(XID id, RESTYPE type)
     if (resource == NULL)
         return NULL;
 
-    if (!AddResource(id, type, resource)) {
-        free(resource);
+    if (!AddResource(id, type, resource))
         return NULL;
-    }
 
     resource->id = id;
     resource->type = type;
-- 
2.7.0



More information about the xorg-devel mailing list