radeonsi: Release storage for smda_uploads when the context is destroyed
authorGert Wollny <gert.wollny@collabora.com>
Tue, 3 Sep 2019 17:24:09 +0000 (19:24 +0200)
committerGert Wollny <gert.wollny@collabora.com>
Fri, 6 Sep 2019 07:44:24 +0000 (09:44 +0200)
This fixes a memory leak in the flush code:

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 in __interceptor_realloc .../gcc-8.3.0/libsanitizer/asan/asan_malloc_linux.cc:105
    #1 in si_buffer_do_flush_region src/gallium/drivers/radeonsi/si_buffer.c:573
    #2 in si_buffer_flush_region src/gallium/drivers/radeonsi/si_buffer.c:608
    #3 in si_buffer_flush_region src/gallium/drivers/radeonsi/si_buffer.c:597

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c

index 487d925..e477b7b 100644 (file)
@@ -294,6 +294,7 @@ static void si_destroy_context(struct pipe_context *context)
        util_dynarray_fini(&sctx->resident_img_needs_color_decompress);
        util_dynarray_fini(&sctx->resident_tex_needs_depth_decompress);
        si_unref_sdma_uploads(sctx);
+       free(sctx->sdma_uploads);
        FREE(sctx);
 }