object/COFF: Properly initalize uses of DataRefImpl.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 2 Nov 2011 19:33:26 +0000 (19:33 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 2 Nov 2011 19:33:26 +0000 (19:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143562 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/COFFObjectFile.cpp

index f19836b718aa0037804a6968aa40a44f2a1352d6..7de51a43f33f9eb6a3bfea5896aa079aa0f3b8f8 100644 (file)
@@ -284,6 +284,7 @@ error_code COFFObjectFile::getSymbolSection(DataRefImpl Symb,
     const coff_section *sec;
     if (error_code ec = getSection(symb->SectionNumber, sec)) return ec;
     DataRefImpl Sec;
+    std::memset(&Sec, 0, sizeof(Sec));
     Sec.p = reinterpret_cast<uintptr_t>(sec);
     Result = section_iterator(SectionRef(Sec, this));
   }
@@ -618,6 +619,7 @@ error_code COFFObjectFile::getRelocationSymbol(DataRefImpl Rel,
                                                SymbolRef &Res) const {
   const coff_relocation* R = toRel(Rel);
   DataRefImpl Symb;
+  std::memset(&Symb, 0, sizeof(Symb));
   Symb.p = reinterpret_cast<uintptr_t>(SymbolTable + R->SymbolTableIndex);
   Res = SymbolRef(Symb, this);
   return object_error::success;