[Mesa-dev] [PATCH 3/5] radeon: use _mesa_delete_buffer_object

Nicolai Hähnle nicolai.haehnle at amd.com
Thu Jan 7 14:05:00 PST 2016


On 07.01.2016 16:58, Ian Romanick wrote:
> On 01/05/2016 06:53 PM, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> This is more future-proof, plugs the memory leak of Label and properly
>> destroys the buffer mutex.
>> ---
>>   src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
>> index d9d4f5f..2b76305 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
>> @@ -71,7 +71,7 @@ radeonDeleteBufferObject(struct gl_context * ctx,
>>           radeon_bo_unref(radeon_obj->bo);
>>       }
>>
>> -    free(radeon_obj);
>> +    _mesa_delete_buffer_object(ctx, obj);
>
> _mesa_delete_buffer_object also frees obj->Data.  I know that there are
> some paths where hardware drivers will allocate a system memory buffer.
>   The i915 driver does this for buffers bound to GL_ARRAY_BUFFER or
> GL_ELEMENT_ARRAY_BUFFER.
>
> I was a little bit worried that this could get us into some double-free
> scenarios.  I dug a bit deeper into the various drivers, I think this is
> actually ok.  Patches 3, 4, and 5 are also
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

Thanks for looking into this!

Nicolai


More information about the mesa-dev mailing list