[llvm-branch-commits] [compiler-rt] 3c0d36f - [NFC][lsan] Add nested leak in test

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 29 14:06:58 PST 2020


Author: Vitaly Buka
Date: 2020-12-29T14:01:43-08:00
New Revision: 3c0d36f977d9e012b245c796ddc8596ac3af659b

URL: https://github.com/llvm/llvm-project/commit/3c0d36f977d9e012b245c796ddc8596ac3af659b
DIFF: https://github.com/llvm/llvm-project/commit/3c0d36f977d9e012b245c796ddc8596ac3af659b.diff

LOG: [NFC][lsan] Add nested leak in test

Added: 
    

Modified: 
    compiler-rt/test/lsan/TestCases/suppressions_file.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lsan/TestCases/suppressions_file.cpp b/compiler-rt/test/lsan/TestCases/suppressions_file.cpp
index 29422bd3c2c0..2983c16e2c8a 100644
--- a/compiler-rt/test/lsan/TestCases/suppressions_file.cpp
+++ b/compiler-rt/test/lsan/TestCases/suppressions_file.cpp
@@ -17,19 +17,27 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-void LSanTestLeakingFunc() {
+void* LSanTestLeakingFunc() {
   void *p = malloc(666);
   fprintf(stderr, "Test alloc: %p.\n", p);
+  return p;
+}
+
+void LSanTestUnsuppressedLeakingFunc() {
+  void** p = (void**)LSanTestLeakingFunc();
+  // FIXME: This must be suppressed as well.
+  *p = malloc(777);
+  fprintf(stderr, "Test alloc: %p.\n", *p);
 }
 
 int main() {
-  LSanTestLeakingFunc();
+  LSanTestUnsuppressedLeakingFunc();
   void *q = malloc(1337);
   fprintf(stderr, "Test alloc: %p.\n", q);
   return 0;
 }
 // CHECK: Suppressions used:
 // CHECK: 1 666 *LSanTestLeakingFunc*
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 2114 byte(s) leaked in 2 allocation(s)
 
-// NOSUPP: SUMMARY: {{(Leak|Address)}}Sanitizer: 2003 byte(s) leaked in 2 allocation(s).
+// NOSUPP: SUMMARY: {{(Leak|Address)}}Sanitizer: 2780 byte(s) leaked in 3 allocation(s).


        


More information about the llvm-branch-commits mailing list