Fix bug in copying packet with static data pointer.
--HG-- extra : convert_revision : 2fcf99f050d73e007433c1db2475f2893c5961a0
This commit is contained in:
parent
288f9cf7d2
commit
3b4ff75939
1 changed files with 7 additions and 6 deletions
|
@ -368,14 +368,15 @@ class Packet : public FastAlloc
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Alternate constructor for copying a packet. Copy all fields
|
/** Alternate constructor for copying a packet. Copy all fields
|
||||||
* *except* set data allocation as static... even if the original
|
* *except* if the original packet's data was dynamic, don't copy
|
||||||
* packet's data was dynamic, we don't want to free it when the
|
* that, as we can't guarantee that the new packet's lifetime is
|
||||||
* new packet is deallocated. Note that if original packet used
|
* less than that of the original packet. In this case the new
|
||||||
* dynamic data, user must guarantee that the new packet's
|
* packet should allocate its own data. */
|
||||||
* lifetime is less than that of the original packet. */
|
|
||||||
Packet(Packet *origPkt)
|
Packet(Packet *origPkt)
|
||||||
: cmd(origPkt->cmd), req(origPkt->req),
|
: 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),
|
addr(origPkt->addr), size(origPkt->size),
|
||||||
src(origPkt->src), dest(origPkt->dest),
|
src(origPkt->src), dest(origPkt->dest),
|
||||||
addrSizeValid(origPkt->addrSizeValid),
|
addrSizeValid(origPkt->addrSizeValid),
|
||||||
|
|
Loading…
Reference in a new issue