summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index a6bf3c1e10f..4e3f1067ce2 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -306,8 +306,10 @@ dri2_allocate_buffer(__DRIscreen *sPriv,
buffer->resource =
screen->base.screen->resource_create(screen->base.screen, &templ);
- if (!buffer->resource)
+ if (!buffer->resource) {
+ FREE(buffer);
return NULL;
+ }
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_SHARED;