Mesa (master): panfrost: Don't leak temporary descriptors array

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 30 14:43:00 UTC 2020


Module: Mesa
Branch: master
Commit: bc11deb86d8bc037d842a04f8782461a5472ecf1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc11deb86d8bc037d842a04f8782461a5472ecf1

Author: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date:   Mon Apr 27 16:09:02 2020 +0200

panfrost: Don't leak temporary descriptors array

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 at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4724>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 439a09ca54c..4146c8c6742 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -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];
 



More information about the mesa-commit mailing list