[Mesa-dev] [PATCH v14 15/36] i965: Improve same-buffer restriction for imports

Daniel Stone daniel at fooishbar.org
Mon Jun 5 14:18:13 UTC 2017


Hi Varad,

On 5 June 2017 at 15:13, Varad Gautam <varad.gautam at collabora.com> wrote:
> On Mon, 2017-06-05 at 14:53 +0100, Daniel Stone wrote:
>> 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?

It's safe since it's not dereferenced: we only care about the absolute
value of the pointers, not the content of the memory they point to.
This was also leaking the fd[0] BO and doing the size calculation
twice: would you take https://hastebin.com/xofidugico as a fixup?

Cheers,
Daniel


More information about the mesa-dev mailing list