Delete the Request for a no-response Packet
authorSteve Reinhardt <stever@gmail.com>
Mon, 24 Mar 2008 05:08:02 +0000 (01:08 -0400)
committerSteve Reinhardt <stever@gmail.com>
Mon, 24 Mar 2008 05:08:02 +0000 (01:08 -0400)
when the Packet is deleted, since the requester
can't possibly do it.

--HG--
extra : convert_revision : 8571b144ecb3c70efc06d09faa8b3161fb58352d

src/mem/packet.hh
src/mem/tport.cc

index 7aad9de98abe29e9ded9ae65071b20f4230ac52e..a278a394581a648ea8f510bdca795a5ee72e60d8 100644 (file)
@@ -455,7 +455,15 @@ class Packet : public FastAlloc, public Printable
 
     /** Destructor. */
     ~Packet()
-    { if (staticData || dynamicData) deleteData(); }
+    {
+        // If this is a request packet for which there's no response,
+        // delete the request object here, since the requester will
+        // never get the chance.
+        if (req && isRequest() && !needsResponse())
+            delete req;
+        if (staticData || dynamicData)
+            deleteData();
+    }
 
     /** Reinitialize packet address and size from the associated
      *   Request object, and reset other fields that may have been
index 9fa27046b30b52374788131bddf78b29a4401477..ad5e959095d0af6175675a258c3f540563c0ebf5 100644 (file)
@@ -83,7 +83,6 @@ SimpleTimingPort::recvTiming(PacketPtr pkt)
         assert(pkt->isResponse());
         schedSendTiming(pkt, curTick + latency);
     } else {
-        delete pkt->req;
         delete pkt;
     }