diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2007-07-14 13:14:53 -0700 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2007-07-14 13:14:53 -0700 |
commit | 3b4ff759398371ac14b7d694de1c87af245f7d42 (patch) | |
tree | b8de292663317c650ff52b211a91a5ba2cc34529 /src/mem | |
parent | 288f9cf7d24d506a0776405000e04ede6fa38384 (diff) | |
download | gem5-3b4ff759398371ac14b7d694de1c87af245f7d42.tar.xz |
Fix bug in copying packet with static data pointer.
--HG--
extra : convert_revision : 2fcf99f050d73e007433c1db2475f2893c5961a0
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/packet.hh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mem/packet.hh b/src/mem/packet.hh index 16bc6f458..c90842dee 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -368,14 +368,15 @@ class Packet : public FastAlloc } /** Alternate constructor for copying a packet. Copy all fields - * *except* set data allocation as static... even if the original - * packet's data was dynamic, we don't want to free it when the - * new packet is deallocated. Note that if original packet used - * dynamic data, user must guarantee that the new packet's - * lifetime is less than that of the original packet. */ + * *except* if the original packet's data was dynamic, don't copy + * that, as we can't guarantee that the new packet's lifetime is + * less than that of the original packet. In this case the new + * packet should allocate its own data. */ Packet(Packet *origPkt) : cmd(origPkt->cmd), req(origPkt->req), - data(NULL), staticData(false), dynamicData(false), arrayData(false), + data(origPkt->staticData ? origPkt->data : NULL), + staticData(origPkt->staticData), + dynamicData(false), arrayData(false), addr(origPkt->addr), size(origPkt->size), src(origPkt->src), dest(origPkt->dest), addrSizeValid(origPkt->addrSizeValid), |