modesetting: avoid double free if AddResource fails

ms_dri2_frame_event_client_gone or ms_dri2_frame_event_drawable_gone
already free the resource.

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:30 +01:00 committed by Adam Jackson
parent 164753f158
commit acf263df81

View File

@ -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;