MidiEvent needs destructor for _edata

• Apr 4, 2017 - 15:55
Reported version

MidiEvent may (or may not) contain a string in _edata. Existing code (e.g. exportmidi.cpp) creates this on the heap and copies in the pointer with setEData. Because there's no code to free the storage _edata points to, it will leak if used. I didn't try fixing this as I wasn't sure the best way; I think one would need to track if setEData is called multiple times (or not at all), but also I was not sure if elsewhere storage managed by a separate object might be referred to here. Maybe the better solution is have setEData copy the string, and change callers to allocate on the stack instead of heap.

I think this is pretty minor as I think (but am not sure) it only leaks for a few events (e.g. notes do not have _edata), and only on exports. I assume this is also in 2.0.3 but didn't go check.