Use-after-free in juce_linux_Midi.cpp

#1

The function AlsaClient::deletePort is incorrect, it calls ports.remove(port->portId) while it should be doing something like ports.set(port->portId, nullptr) (shuffling the “ports” array element is forbidden since it is access via the portId index, which does not change).

(Another way of fixing that would be to replace OwnedArray<Port> ports with a map that associates a “portId” with a “Port” object)

#2

Thanks! I’ll get that sorted out.