[Mesa-dev] [PATCH 3/4] r200: Free glCtx in radeonDestroyContext

Aaron Watry awatry at gmail.com
Mon Jan 6 11:41:20 PST 2014


On Mon, Jan 6, 2014 at 1:26 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 01/02/2014 10:38 AM, Aaron Watry wrote:
>> Note: I don't have hardware to test this, but I believe it to be correct.
>>
>> Found while tracking down a related leak in evergreen context management.
>> ---
>>  src/mesa/drivers/dri/radeon/radeon_common_context.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> index 6dec137..161a0b7 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> @@ -245,8 +245,8 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
>>       _swrast_DestroyContext( &radeon->glCtx );
>>
>>       /* free atom list */
>> -     /* free the Mesa context data */
>> -     _mesa_free_context_data(&radeon->glCtx);
>> +     /* free the Mesa context and its data */
>> +     _mesa_destroy_context(&radeon->glCtx);
>
> This will free(radeon), and...
>
>>       /* free the option cache */
>>       driDestroyOptionCache(&radeon->optionCache);
>
> ...this will dereference it.
>
> The context is already freed at the bottom of this function, so I don't
> think this patch is necessary at all.
>

Fair enough.  Given that I don't have hardware to test with, I'll drop
this patch in v2 of the series (to address Michel's comments).

--Aaron


More information about the mesa-dev mailing list