diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2014-01-24 15:29:29 -0600 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2014-01-24 15:29:29 -0600 |
commit | f2b0b551cc02084dbabe0c14a2fd64dd85a3fbfc (patch) | |
tree | 6c9a1202fe458d5368aceeb0a816534fd751cfd4 /src | |
parent | 7db542c0ddf8904bda00d3c73408172136cd48a3 (diff) | |
download | gem5-f2b0b551cc02084dbabe0c14a2fd64dd85a3fbfc.tar.xz |
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 (limited to 'src')
-rw-r--r-- | src/arch/x86/pagetable_walker.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/arch/x86/pagetable_walker.cc b/src/arch/x86/pagetable_walker.cc index 45f902999..63397a607 100644 --- a/src/arch/x86/pagetable_walker.cc +++ b/src/arch/x86/pagetable_walker.cc @@ -165,8 +165,18 @@ Walker::recvRetry() 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 & |