[Mesa-dev] [PATCH 1/2] glsl/shader_cache: Fix memory leak
Timothy Arceri
tarceri at itsqueeze.com
Sun Apr 2 23:53:12 UTC 2017
On 03/04/17 09:52, Timothy Arceri wrote:
>
>
> On 03/04/17 03:31, Bartosz Tomczyk wrote:
>> ---
>> src/compiler/glsl/shader_cache.cpp | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/src/compiler/glsl/shader_cache.cpp
>> b/src/compiler/glsl/shader_cache.cpp
>> index ea1bc01f02..8c42a95664 100644
>> --- a/src/compiler/glsl/shader_cache.cpp
>> +++ b/src/compiler/glsl/shader_cache.cpp
>> @@ -1273,6 +1273,8 @@ shader_cache_write_program_metadata(struct
>> gl_context *ctx,
>>
>> disk_cache_put(cache, prog->data->sha1, metadata->data,
>> metadata->size);
>>
>> + if(metadata->data)
>> + free(metadata->data);
>> free(metadata);
>
> Thanks. This was my mistake in df1d5fc44218834 when changing from using
> ralloc.
>
> I think I would rather see a new helper added to blob.h
>
> static inline void
> blob_destroy(struct blob *blob)
> {
> free(metadata->data);
> free(metadata);
> }
>
>
Oh and please update blob_test.c to use the new helper also.
More information about the mesa-dev
mailing list