changeset c9ef81684179 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=c9ef81684179
description:
        x86: Fix memory leak in table walker

        This patch fixes a memory leak in the table walker, by ensuring that
        the sender state is deleted again if the request packet cannot be
        successfully sent.

diffstat:

 src/arch/x86/pagetable_walker.cc |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r c75015bbbd78 -r c9ef81684179 src/arch/x86/pagetable_walker.cc
--- a/src/arch/x86/pagetable_walker.cc  Fri Jan 24 15:29:29 2014 -0600
+++ b/src/arch/x86/pagetable_walker.cc  Fri Jan 24 15:29:29 2014 -0600
@@ -165,8 +165,18 @@
 
 bool Walker::sendTiming(WalkerState* sendingState, PacketPtr pkt)
 {
-    pkt->pushSenderState(new WalkerSenderState(sendingState));
-    return port.sendTimingReq(pkt);
+    WalkerSenderState* walker_state = new WalkerSenderState(sendingState);
+    pkt->pushSenderState(walker_state);
+    if (port.sendTimingReq(pkt)) {
+        return true;
+    } else {
+        // undo the adding of the sender state and delete it, as we
+        // will do it again the next time we attempt to send it
+        pkt->popSenderState();
+        delete walker_state;
+        return false;
+    }
+
 }
 
 BaseMasterPort &
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to