util: Fix memory leaks in unit test.
authorVinson Lee <vlee@freedesktop.org>
Sun, 9 Aug 2020 04:26:12 +0000 (21:26 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 11 Aug 2020 21:11:01 +0000 (14:11 -0700)
Fix warnings reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable bt1 going out of scope leaks the storage
it points to.
leaked_storage: Variable bt2 going out of scope leaks the storage
it points to.

Fixes: d0d14f3f6481 ("util: Add unit test for stack backtrace caputure")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6246>

src/util/u_debug_stack_test.cpp

index b5f8ea4ba386e8551edf68a8ee55cef4467df048..6add3e989b27ced00f6aaf36326b1c7638aff86e 100644 (file)
@@ -106,6 +106,9 @@ TEST(u_debug_stack_test, capture_not_overwritten)
    if (size > 0) {
       EXPECT_STRNE(bt1, bt2);
    }
+
+   free(bt1);
+   free(bt2);
 }
 
 #endif