mem: Fix guest corruption when caches handle uncacheable accesses
[gem5.git] / src / mem / page_table.cc
index ce3448c4c912638a10990709e534252b7e548b08..be862e429baabf4ebd7ebee1cfd0a566a42093f3 100644 (file)
@@ -217,16 +217,18 @@ PageTable::unserialize(Checkpoint *cp, const std::string &section)
 {
     int i = 0, count;
     paramIn(cp, section, "ptable.size", count);
-    Addr vaddr;
-    TheISA::TlbEntry *entry;
 
     pTable.clear();
 
-    while(i < count) {
+    while (i < count) {
+        TheISA::TlbEntry *entry;
+        Addr vaddr;
+
         paramIn(cp, csprintf("%s.Entry%d", name(), i), "vaddr", vaddr);
         entry = new TheISA::TlbEntry();
         entry->unserialize(cp, csprintf("%s.Entry%d", name(), i));
         pTable[vaddr] = *entry;
+        delete entry;
         ++i;
     }
 }