[Mesa-dev] [PATCH] Bad free in _mesa_delete_buffer_object

Siavash Eliasi siavashserver at gmail.com
Fri Jan 31 07:04:36 PST 2014


Hello, I'm responsible for the caused inconvenience. I forgot to use 
_mesa_align_free to clean up the allocated memory blocked using 
_mesa_align_malloc. Good catch and thanks for the patch! :)

On POSIX aligned allocated memory (using posix_memalign) should be freed 
using ordinary free() and I didn't noticed any crashes. However other 
platforms do require special treatment ( eg _aligned_malloc and 
_aligned_free on MS Windows), so _mesa_align_free should have been 
called to handle those cases.

Best regards,
Siavash Eliasi.

On 01/31/2014 02:38 PM, Colin Harrison wrote:
> Hi,
>
> I can get a crash without this change (now _mesa_align_malloc is being used
> for buffer object data)
>
> --- ./src/mesa/main/save_bufferobj.c    2014-01-29 17:23:22.387706584 +0000
> +++ ./src/mesa/main/bufferobj.c 2014-01-31 11:01:26.164078585 +0000
> @@ -407,7 +407,7 @@ _mesa_delete_buffer_object(struct gl_con
>   {
>      (void) ctx;
>
> -   free(bufObj->Data);
> +   _mesa_align_free(bufObj->Data);
>
>      /* assign strange values here to help w/ debugging */
>      bufObj->RefCount = -1000;
>
> Thanks,
> Colin Harrison
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list