[ASan] Fix leaks in ASan tests found by LSan
authorAlexey Samsonov <samsonov@google.com>
Thu, 18 Jul 2013 12:59:52 +0000 (12:59 +0000)
committerAlexey Samsonov <samsonov@google.com>
Thu, 18 Jul 2013 12:59:52 +0000 (12:59 +0000)
llvm-svn: 186577

compiler-rt/lib/asan/tests/asan_test.cc

index 9bb474d..c87e6da 100644 (file)
@@ -373,6 +373,7 @@ TEST(AddressSanitizer, ReallocFreedPointerTest) {
 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, MallocUsableSizeTest) {
                kMallocUsableSizeErrorMsg);
   free(array);
   EXPECT_DEATH(malloc_usable_size(array), kMallocUsableSizeErrorMsg);
+  delete int_ptr;
 }
 #endif