[Mesa-dev] [PATCH 3/5] radeon: use _mesa_delete_buffer_object
Ian Romanick
idr at freedesktop.org
Thu Jan 7 13:58:38 PST 2016
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>
> }
More information about the mesa-dev
mailing list