panfrost: Don't leak temporary descriptors array
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Mon, 27 Apr 2020 14:09:02 +0000 (16:09 +0200)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 30 Apr 2020 14:27:38 +0000 (16:27 +0200)
As found by Coverity:

>>>     CID 1462596:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "descriptors" going out of scope leaks the storage it points to.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4724>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 439a09ca54ceffccab2315e27d3abe74c6610b58..4146c8c6742be5375066dd55a6e4244c5ee6679e 100644 (file)
@@ -1328,6 +1328,8 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
                                                               descriptors,
                                                               sizeof(struct bifrost_texture_descriptor) *
                                                                       ctx->sampler_view_count[stage]);
+
+                free(descriptors);
         } else {
                 uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];