Define the instance variable Buffer, not the automatic variable Buffer.
authorChris Lattner <sabre@nondot.org>
Thu, 25 Sep 2003 04:13:53 +0000 (04:13 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 25 Sep 2003 04:13:53 +0000 (04:13 +0000)
This was causing us to munmap random stuff, which is obviously bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8709 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/ReaderWrappers.cpp

index 439e982a60c1614d5e095ee9cc09888a114db98c..c1d091800e7fbec4bb2fb5b89aedb4a377845b3f 100644 (file)
@@ -38,7 +38,6 @@ namespace {
   public:
     BytecodeFileReader(const std::string &Filename);
     ~BytecodeFileReader();
-
   };
 }
 
@@ -54,8 +53,8 @@ BytecodeFileReader::BytecodeFileReader(const std::string &Filename) {
 
   // mmap in the file all at once...
   Length = StatBuf.st_size;
-  unsigned char *Buffer = (unsigned char*)mmap(0, Length, PROT_READ, 
-                                               MAP_PRIVATE, FD, 0);
+  Buffer = (unsigned char*)mmap(0, Length, PROT_READ, MAP_PRIVATE, FD, 0);
+
   if (Buffer == (unsigned char*)MAP_FAILED)
     throw std::string("Error mmapping file!");