[PATCH] D63146: [scudo][standalone] Unmap memory in tests

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 09:50:47 PDT 2019


morehouse added inline comments.


================
Comment at: lib/scudo/standalone/primary32.h:93
+      if (PossibleRegions[I])
+        unmap(reinterpret_cast<void *>(I * RegionSize), RegionSize);
+    PossibleRegions.unmapTestOnly();
----------------
This looks incorrect.  Is `I * RegionSize` a valid address?


================
Comment at: lib/scudo/standalone/tests/primary_test.cc:25
   const scudo::uptr NumberOfAllocations = 32U;
-  std::unique_ptr<Primary> Allocator(new Primary);
+  auto Deleter = [](Primary *P) { P->unmapTestOnly(); };
+  std::unique_ptr<Primary, decltype(Deleter)> Allocator(new Primary, Deleter);
----------------
Should this also `delete P`?  Same for below.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63146/new/

https://reviews.llvm.org/D63146





More information about the llvm-commits mailing list