[compiler-rt] r186577 - [ASan] Fix leaks in ASan tests found by LSan

Alexey Samsonov samsonov at google.com
Thu Jul 18 05:59:53 PDT 2013


Author: samsonov
Date: Thu Jul 18 07:59:52 2013
New Revision: 186577

URL: http://llvm.org/viewvc/llvm-project?rev=186577&view=rev
Log:
[ASan] Fix leaks in ASan tests found by LSan

Modified:
    compiler-rt/trunk/lib/asan/tests/asan_test.cc

Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=186577&r1=186576&r2=186577&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Thu Jul 18 07:59:52 2013
@@ -373,6 +373,7 @@ TEST(AddressSanitizer, ReallocFreedPoint
 TEST(AddressSanitizer, ReallocInvalidPointerTest) {
   void *ptr = Ident(malloc(42));
   EXPECT_DEATH(ptr = realloc((int*)ptr + 1, 77), "attempting free.*not malloc");
+  free(ptr);
 }
 
 TEST(AddressSanitizer, ZeroSizeMallocTest) {
@@ -411,6 +412,7 @@ TEST(AddressSanitizer, MallocUsableSizeT
                kMallocUsableSizeErrorMsg);
   free(array);
   EXPECT_DEATH(malloc_usable_size(array), kMallocUsableSizeErrorMsg);
+  delete int_ptr;
 }
 #endif
 





More information about the llvm-commits mailing list