Hi Daniel,

On Mon, 2017-06-05 at 14:53 +0100, Daniel Stone wrote:
> Hi Varad,
> 
> On 30 May 2017 at 12:53, Varad Gautam <varadgau...@gmail.com> wrote:
> > 
> > +   /* We only support all planes from the same bo.
> > +    * brw_bo_gem_create_from_prime() should return the same pointer for all
> > +    * fds received here */
> > +   bo = brw_bo_gem_create_from_prime(screen->bufmgr, fds[0], size);
> > +   for (i = 1; i < num_fds; i++) {
> > +      if (bo != brw_bo_gem_create_from_prime(screen->bufmgr, fds[i], size))
> > +         return NULL;
> 
> This above takes a ref, which gets leaked.
> 
>            struct brw_bo *aux =
> brw_bo_gem_create_from_prime(screen->bufmgr, fds[i], size);
>            brw_bo_unreference(aux);
>            if (aux != bo)

Thanks for spotting this. Can the unref(aux) happen before comparing against bo?
Or should this be something like:
   for (...) {
      struct brw_bo *aux = brw_bo_gem_create_from_prime(screen->bufmgr, fds[i],
size);
      if (aux != bo) {
         brw_bo_unreference(aux);
         return NULL;
      }
      brw_bo_unreference(aux);
   }
>               return NULL;
> 
> Thanks for the fix!
> 
> Cheers,
> Daniel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to