From: Vinson Lee Date: Sun, 6 Nov 2011 05:19:31 +0000 (-0700) Subject: st/dri: Fix memory leak on error path. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4515d106cd40351133c89855e3277a70bba8721;p=mesa.git st/dri: Fix memory leak on error path. Fixes Coverity resource leak defect. Reviewed-by: José Fonseca --- 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;