From f4515d106cd40351133c89855e3277a70bba8721 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 5 Nov 2011 22:19:31 -0700 Subject: st/dri: Fix memory leak on error path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes Coverity resource leak defect. Reviewed-by: José Fonseca --- src/gallium/state_trackers/dri/drm/dri2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gallium/state_trackers') 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; -- cgit v1.2.3