Mesa (main): panfrost: Fix memory leaks on unit test failures.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 25 20:24:10 UTC 2022


Module: Mesa
Branch: main
Commit: 7898721cce41e93e09c3d055e618754ef064f1ae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7898721cce41e93e09c3d055e618754ef064f1ae

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Sun Apr 24 21:28:50 2022 -0700

panfrost: Fix memory leaks on unit test failures.

Change ASSERT_EQ to EXPECT_EQ to avoid aborting before freeing memory.

Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable tiled going out of scope leaks the storage it points to.
leaked_storage: Variable linear going out of scope leaks the storage it points to.
leaked_storage: Variable ref going out of scope leaks the storage it points to.

Fixes: bb6c14a6978 ("panfrost: Unit test u-interleaved tiling routines")
Suggested-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16127>

---

 src/panfrost/shared/test/test-tiling.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/shared/test/test-tiling.cpp b/src/panfrost/shared/test/test-tiling.cpp
index b06954485d0..e6b9fe669f5 100644
--- a/src/panfrost/shared/test/test-tiling.cpp
+++ b/src/panfrost/shared/test/test-tiling.cpp
@@ -160,9 +160,9 @@ test(unsigned width, unsigned height, unsigned rx, unsigned ry,
                     dst_stride, src_stride, format, store);
 
    if (store)
-      ASSERT_EQ(memcmp(ref, tiled, bpp * tiled_width * tiled_height), 0);
+      EXPECT_EQ(memcmp(ref, tiled, bpp * tiled_width * tiled_height), 0);
    else
-      ASSERT_EQ(memcmp(ref, linear, bpp * rw * linear_stride), 0);
+      EXPECT_EQ(memcmp(ref, linear, bpp * rw * linear_stride), 0);
 
    free(ref);
    free(tiled);



More information about the mesa-commit mailing list