[PATCH] [libcxxabi] Cleanup memory in tests to placate ASAN.

David Blaikie dblaikie at gmail.com
Fri Nov 14 16:31:32 PST 2014


================
Comment at: test/catch_ptr_02.cpp:145
@@ -144,1 +144,3 @@
         assert(p != 0);
+        // NOTE: delete needed to placate ASAN.
+        delete p;
----------------
Could just rephrase this:

  vDerived d;
  try
  {
      throw &d;

I assume that'd be sufficiently equivalent without having to pass owning pointers through the throw/catch?

================
Comment at: test/inherited_exception.cpp:160
@@ -159,1 +159,3 @@
         assert(true);
+        // NOTE: delete needed to placate ASAN.
+        delete static_cast<Child*>(const_cast<Base2*>(c));
----------------
This one could use a global variable & throwing the address of that.

================
Comment at: test/test_vector1.cpp:238
@@ -237,1 +237,3 @@
+// Delete "three" to placate ASAN.
+    __cxxabiv1::__cxa_vec_delete3(three, 40, 8, my_destruct, my_dealloc3);
 
----------------
& I don't understand this one well enough to figure out why 'three' needs to be handled here but 'one' and 'two' are fine... all the deletes/news seem to appear in triples, so why is this one weird?

http://reviews.llvm.org/D6281






More information about the cfe-commits mailing list