> # HG changeset patch
> # User Brad Beckmann <[email protected]>
> # Date 1261413068 28800
> # Node ID 264849268ebbd0a50e121582fb184f97bc80438e
> # Parent 54d3c8cb0b7a100769137d30256c3a9d2d9131d7
> ruby: ruby request now copies data
> Instead of just updating the data pointer, ruby request now copies the
> data when all constructor parameters are specified.
>
> diff -r 54d3c8cb0b7a -r 264849268ebb src/mem/ruby/libruby.hh
> --- a/src/mem/ruby/libruby.hh Mon Dec 21 08:31:08 2009 -0800
> +++ b/src/mem/ruby/libruby.hh Mon Dec 21 08:31:08 2009 -0800
> @@ -45,14 +45,16 @@
> PacketPtr _pkt,
> unsigned _proc_id = 0)
> : paddr(_paddr),
> - data(_data),
> len(_len),
> pc(_pc),
> type(_type),
> access_mode(_access_mode),
> pkt(_pkt),
> proc_id(_proc_id)
> - {}
> + {
> + data = new uint8_t[len];
> + memcpy(data, _data, len);
> + }
> };
This seems dangerous. You're creating a new object, but there's no
delete. If this is correct, perhaps add a comment explaining how it
gets deleted. Though, maybe with context this would be obvious.
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev