i915/sync: Don't crash when deleting sync object
authorChad Versace <chad.versace@intel.com>
Wed, 6 May 2015 02:05:29 +0000 (19:05 -0700)
committerChad Versace <chad.versace@intel.com>
Thu, 7 May 2015 15:11:21 +0000 (08:11 -0700)
Don't pass NULL to drm_intel_bo_unreference(). It doesn't like that.

Bug found by code inspection.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i915/intel_syncobj.c

index d918cd7d02e04ed1a8b925ec7eaeea4d6707b3fb..92a246dfdaebbeafa11a7c5f66a13059a45f6d1d 100644 (file)
@@ -60,7 +60,9 @@ intel_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s)
 {
    struct intel_sync_object *sync = (struct intel_sync_object *)s;
 
-   drm_intel_bo_unreference(sync->bo);
+   if (sync->bo)
+      drm_intel_bo_unreference(sync->bo);
+
    free(sync);
 }