[Mesa-dev] [PATCH] Release gl_debug_state when destroying context.

Mike Stroyan mike at lunarg.com
Wed Mar 12 08:22:39 PDT 2014


Brian,

  Please push that.  I haven't gotten commit access for myself yet.


On Tue, Mar 11, 2014 at 5:42 PM, Brian Paul <brianp at vmware.com> wrote:

> On 03/11/2014 05:07 PM, Mike Stroyan wrote:
>
>> Commit 6e8d04a caused a leak by allocating ctx->Debug but never freeing
>> it.
>> Release the memory in _mesa_free_errors_data when destroying a context.
>> Use FREE to match CALLOC_STRUCT from _mesa_get_debug_state.
>> ---
>>   src/mesa/main/errors.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
>> index 8ec6a8c..9151718 100644
>> --- a/src/mesa/main/errors.c
>> +++ b/src/mesa/main/errors.c
>> @@ -969,7 +969,7 @@ _mesa_init_errors(struct gl_context *ctx)
>>
>>   /**
>>    * Loop through debug group stack tearing down states for
>> - * filtering debug messages.
>> + * filtering debug messages.  Then free debug output state.
>>    */
>>   void
>>   _mesa_free_errors_data(struct gl_context *ctx)
>> @@ -980,6 +980,9 @@ _mesa_free_errors_data(struct gl_context *ctx)
>>         for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
>>            free_errors_data(ctx, i);
>>         }
>> +      FREE(ctx->Debug);
>> +      /* set to NULL just in case it is used before context is
>> completely gone. */
>> +      ctx->Debug = NULL;
>>      }
>>   }
>>
>>
>>
> Reviewed-by: Brian Paul <brianp at vmware.com>
>
> Thanks, Mike!  Do you need me to push this for you?
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 

 Mike Stroyan - Software Architect
 LunarG, Inc.  - The Graphics Experts
 Cell:  (970) 219-7905
 Email: Mike at LunarG.com
 Website: http://www.lunarg.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140312/a6c7984a/attachment.html>


More information about the mesa-dev mailing list