ExpressLRS / Backpack

Firmware for ExpressLRS compatible backpacks
GNU General Public License v3.0
100 stars 73 forks source link

Don't leak msppacket every Get on HDZero/Skyzone #100

Closed CapnBry closed 1 year ago

CapnBry commented 1 year ago

GetRecordingState() and GetChannelIndex() on HDZero and Skyzone VRX Backpacks allocate a new msppacket every call, but never free it. This fixes it by using a value off the stack instead of the heap.

The msppacket structure is pretty big since it contains a 64 byte buffer in addition to its other members so this will add up, but it is unlikely anyone would run out of memory due to this even though every SendIndexCmd() calls Get at least twice.