jingoro2112 / wrench

practical embedded script interpreter
MIT License
106 stars 9 forks source link

Memory leak #39

Closed darksotmoon closed 3 months ago

darksotmoon commented 3 months ago

WrenchPacket is allocated but never freed.

https://github.com/jingoro2112/wrench/blob/2f37ffa6bc24c2e017d37c5974ecac4174870512/discrete_src/debug/client_debug.cpp#L96

Is alloc a copy constructor? I can't work out why it is duplicating the packet. This is the quick fix for me:

WrenchPacket * tx_packet = WrenchPacket::alloc(packet);
WrenchPacket *reply = transmit( tx_packet );
delete tx_packet;
jingoro2112 commented 3 months ago

oops! thank you for pointing this out, obviously the debugger still has a lot of work to be done on it. fixed this in latest