[Mesa-dev] [PATCH] st/dri: Fix memory leak on error path.

Jose Fonseca jfonseca at vmware.com
Sun Nov 6 02:25:06 PST 2011


Both patches look good to me. Thanks Vinson.

Jose

----- Original Message -----
> Fixes Coverity resource leak defect.
> ---
>  src/gallium/state_trackers/dri/drm/dri2.c |    4 +++-
>  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 a6bf3c1..4e3f106 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;
> --
> 1.7.7
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list