[PATCH xserver 2/5] dri1: Fix unchecked AddResource

Julien Cristau jcristau at debian.org
Tue Mar 1 20:30:59 UTC 2016


On Tue, Mar  1, 2016 at 14:09:30 -0500, Adam Jackson wrote:

> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xfree86/dri/dri.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
Kind of silly that those result in BadValue instead of BadAlloc, but
meh, dri1.

for the series (1/5 and 2/5):
Reviewed-by: Julien Cristau <jcristau at debian.org>

Cheers,
Julien

> diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
> index 875c9cc..0046e52 100644
> --- a/hw/xfree86/dri/dri.c
> +++ b/hw/xfree86/dri/dri.c
> @@ -1032,7 +1032,8 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
>      }
>  
>      /* track this in case the client dies before cleanup */
> -    AddResource(context, DRIContextPrivResType, (void *) pDRIContextPriv);
> +    if (!AddResource(context, DRIContextPrivResType, (void *) pDRIContextPriv))
> +        return FALSE;
>  
>      return TRUE;
>  }
> @@ -1263,8 +1264,9 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
>          }
>  
>          /* track this in case the client dies */
> -        AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
> -                    (void *) (intptr_t) pDrawable->id);
> +        if (!AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
> +                         (void *) (intptr_t) pDrawable->id))
> +            return FALSE;
>  
>          if (pDRIDrawablePriv->hwDrawable) {
>              drmUpdateDrawableInfo(pDRIPriv->drmFD,
> -- 
> 2.5.0
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list