summaryrefslogtreecommitdiff
path: root/src/mem/cache/cache.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-12-17 17:07:11 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2015-12-17 17:07:11 -0500
commit97887eb6dc9e548c9b5719727fd4783ef157917c (patch)
tree65b928581be0e6135b1c7b3ca1ffecf63059e3b2 /src/mem/cache/cache.cc
parent08754488a30da178effd0414f198462bf268d715 (diff)
downloadgem5-97887eb6dc9e548c9b5719727fd4783ef157917c.tar.xz
mem: Fix memory allocation bug in deferred snoop handling
This patch fixes a corner case in the deferred snoop handling, where requests ended up being used by multiple packets with different lifetimes, and inadvertently got deleted while they were still in use.
Diffstat (limited to 'src/mem/cache/cache.cc')
-rw-r--r--src/mem/cache/cache.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc
index 29919ccdf..67e889453 100644
--- a/src/mem/cache/cache.cc
+++ b/src/mem/cache/cache.cc
@@ -2005,15 +2005,9 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
}
if (!respond && is_timing && is_deferred) {
- // if it's a deferred timing snoop then we've made a copy of
- // both the request and the packet, and so if we're not using
- // those copies to respond and delete them here
- DPRINTF(Cache, "Deleting pkt %p and request %p for cmd %s addr: %p\n",
- pkt, pkt->req, pkt->cmdString(), pkt->getAddr());
-
- // the packets needs a response (just not from us), so we also
- // need to delete the request and not rely on the packet
- // destructor
+ // if it's a deferred timing snoop to which we are not
+ // responding, then we've made a copy of both the request and
+ // the packet, delete them here
assert(pkt->needsResponse());
delete pkt->req;
delete pkt;