[llvm-branch-commits] [llvm-branch] r81638 - /llvm/branches/release_26/lib/Support/Allocator.cpp

Tanya Lattner tonic at nondot.org
Sat Sep 12 15:26:40 PDT 2009


Author: tbrethou
Date: Sat Sep 12 17:26:39 2009
New Revision: 81638

URL: http://llvm.org/viewvc/llvm-project?rev=81638&view=rev
Log:
Merge 81308 from mainline.
Make sure the memory range is writable before memset'ing it.


Modified:
    llvm/branches/release_26/lib/Support/Allocator.cpp

Modified: llvm/branches/release_26/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/Support/Allocator.cpp?rev=81638&r1=81637&r2=81638&view=diff

==============================================================================
--- llvm/branches/release_26/lib/Support/Allocator.cpp (original)
+++ llvm/branches/release_26/lib/Support/Allocator.cpp Sat Sep 12 17:26:39 2009
@@ -15,6 +15,7 @@
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Recycler.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/System/Memory.h"
 #include <cstring>
 
 namespace llvm {
@@ -60,6 +61,7 @@
 #ifndef NDEBUG
     // Poison the memory so stale pointers crash sooner.  Note we must
     // preserve the Size and NextPtr fields at the beginning.
+    sys::Memory::setRangeWritable(Slab + 1, Slab->Size - sizeof(MemSlab));
     memset(Slab + 1, 0xCD, Slab->Size - sizeof(MemSlab));
 #endif
     Allocator.Deallocate(Slab);





More information about the llvm-branch-commits mailing list