mem: Fix use-after-free bug
authorMitch Hayenga <mitch.hayenga+gem5@gmail.com>
Tue, 8 Jan 2013 13:54:06 +0000 (08:54 -0500)
committerMitch Hayenga <mitch.hayenga+gem5@gmail.com>
Tue, 8 Jan 2013 13:54:06 +0000 (08:54 -0500)
Running with valgrind I noticed a use after free originating from
simple_mem.cc.  It looks like this is a known issue and this additional call
site was missed in an earlier patch.

src/mem/simple_mem.cc

index d3a53a26f38304f8686178f65640ab6d726f8f88..7dd0fd1011d55d98863d67749534498faee18e9d 100644 (file)
@@ -154,7 +154,7 @@ SimpleMemory::recvTimingReq(PacketPtr pkt)
         assert(pkt->isResponse());
         port.schedTimingResp(pkt, curTick() + latency);
     } else {
-        delete pkt;
+        pendingDelete.push_back(pkt);
     }
 
     return true;