diff options
author | Sergii Romantsov <sergii.romantsov@globallogic.com> | 2019-05-27 16:45:35 +0300 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2019-07-17 08:10:41 +0000 |
commit | 43682f0c6f4384ec9d8dbeedfd5eaef769141ace (patch) | |
tree | f356dc41da9b5d3993054d5072cd3a7c2fa9d278 | |
parent | 6ba4ce97b722f9561cac8c8263e0355b4212378c (diff) | |
download | mesa-43682f0c6f4384ec9d8dbeedfd5eaef769141ace.tar.gz |
meta: memory leak of CopyPixels usage
Meta of CopyPixel generates a buffer object
but does not free it on cleanup.
Fixes: 37d11b13ce1d (meta: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects)
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7417b432113cd5b542f5bb4efd6c2b6120157576)
-rw-r--r-- | src/mesa/drivers/common/meta.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 3515e312023..725584d5ba3 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -104,6 +104,8 @@ static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex); static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear); +static void meta_copypix_cleanup(struct gl_context *ctx, + struct copypix_state *copypix); static void meta_decompress_cleanup(struct gl_context *ctx, struct decompress_state *decompress); static void meta_drawpix_cleanup(struct gl_context *ctx, @@ -422,6 +424,7 @@ _mesa_meta_free(struct gl_context *ctx) _mesa_make_current(ctx, NULL, NULL); _mesa_meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit); meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear); + meta_copypix_cleanup(ctx, &ctx->Meta->CopyPix); _mesa_meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap); cleanup_temp_texture(ctx, &ctx->Meta->TempTex); meta_decompress_cleanup(ctx, &ctx->Meta->Decompress); @@ -1595,6 +1598,17 @@ meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear) } } +static void +meta_copypix_cleanup(struct gl_context *ctx, struct copypix_state *copypix) +{ + if (copypix->VAO == 0) + return; + _mesa_DeleteVertexArrays(1, ©pix->VAO); + copypix->VAO = 0; + _mesa_reference_buffer_object(ctx, ©pix->buf_obj, NULL); +} + + /** * Given a bitfield of BUFFER_BIT_x draw buffers, call glDrawBuffers to * set GL to only draw to those buffers. |